Keyword search queries on online social networks

ABSTRACT

In one embodiment, a method includes receiving, from a client system of a first user, a text query including one or more n-grams, including an ambiguous n-gram. The method includes searching multiple keyword generators to identify one or more keyword suggestions matching the ambiguous n-gram, each keyword generator having a particular type. The method includes calculating, by a particular scoring algorithm for each keyword generator, a keyword score for each identified keyword suggestion. The scoring algorithm includes multiple weighting factors chosen based on the type of the keyword generator. The method includes generating a set of suggested queries including at least a portion of the text query and one or more identified keyword suggestions and filtering suggested queries from the set based on privacy settings associated with the identified keyword suggestions. The method includes sending, to the client system, instructions for presenting one or more of the suggested queries.

PRIORITY

This application is a continuation under 35 U.S.C. § 120 of U.S. patentapplication Ser. No. 14/470,607, filed 27 Aug. 2014.

TECHNICAL FIELD

This disclosure generally relates to social graphs and performingsearches for objects within a social-networking environment.

BACKGROUND

A social-networking system, which may include a social-networkingwebsite, may enable its users (such as persons or organizations) tointeract with it and with each other through it. The social-networkingsystem may, with input from a user, create and store in thesocial-networking system a user profile associated with the user. Theuser profile may include demographic information, communication-channelinformation, and information on personal interests of the user. Thesocial-networking system may also, with input from a user, create andstore a record of relationships of the user with other users of thesocial-networking system, as well as provide services (e.g. wall posts,photo-sharing, event organization, messaging, games, or advertisements)to facilitate social interaction between or among users.

The social-networking system may send over one or more networks contentor messages related to its services to a mobile or other computingdevice of a user. A user may also install software applications on amobile or other computing device of the user for accessing a userprofile of the user and other data within the social-networking system.The social-networking system may generate a personalized set of contentobjects to display to a user, such as a newsfeed of aggregated storiesof other users connected to the user.

Social-graph analysis views social relationships in terms of networktheory consisting of nodes and edges. Nodes represent the individualactors within the networks, and edges represent the relationshipsbetween the actors. The resulting graph-based structures are often verycomplex. There can be many types of nodes and many types of edges forconnecting nodes. In its simplest form, a social graph is a map of allof the relevant edges between all the nodes being studied.

SUMMARY OF PARTICULAR EMBODIMENTS

In particular embodiments, a social-networking system may generatestructured queries that include references to particular social-graphelements. These structured queries may be generated, for example, inresponse to a text query provided by a user, or generated as defaultqueries. By providing suggested structured queries to a user's textquery, the social-networking system may provide a powerful way for usersof an online social network to search for elements represented in asocial graph based on their social-graph attributes and their relationto various social-graph elements.

In particular embodiments, the social-networking system may providecustomized keyword completion suggestions in a non-structured format.The social networking system may provide high-quality keywordsuggestions in response to a user inputting a text string into a queryfield. In some embodiments, the social network may access multiplesources within the social network, score the suggestions from thesesources, and then return blended results to the user. Suggested keywordsmay come from a variety of sources, for example, the current query log,list of social-network entities, entity metadata, and grammars from thegrammar model parser. The social-networking system may combine thesuggestions from each source, and present suggested queries to the user.The multi-source functionality may enable better signal for suggestionsto make because it is based on the data existing in the user's network.

In an exemplary embodiment, a method may include accessing a socialgraph. The social graph may include a plurality of nodes and a pluralityof edges connecting the nodes. Each of the edges between two of thenodes may represent a single degree of separation between them. Thenodes may include a first node corresponding to a first user associatedwith an online social network and a plurality of second nodes that eachcorrespond to a concept or a second user associated with the onlinesocial network. The method may include receiving from a client system ofa first user an unstructured text query. The text query may be parsed toidentify one or more n-grams, wherein at least one of the n-grams is anambiguous n-gram. The method may include searching a plurality ofkeyword generators to identify one or more keyword suggestions matchingthe ambiguous n-gram, each identified keyword suggestion correspondingto one or more second nodes of the plurality of second nodes. A keywordscore for each identified keyword suggestion may be calculated. One ormore suggestion queries may be generated. Each suggested query mayinclude one or more n-grams identified from the text query and one ormore identified keyword suggestions having a keyword score greater thana threshold keyword score. The method may include sending, responsive toreceiving the unstructured text query, one or more of the suggestedqueries to the client system of the first user for display, thesuggested queries being displayed in ranked order based on the keywordscores for the identified keyword suggestions including each suggestedquery.

In particular embodiments, the social-networking system may providecustomized search experiences based on the intent of the search query.The social network may determine the intent of a search query based onentity and topic matching, and then blend the generated search resultsin a customized manner based on the determined intent. As an example andnot by way of limitation, if the user is performing a people search asopposed to a celebrity search or a pages search, the user experience maybe improved by determining the intent of the query in order to determinewhat will be displayed to the querying user. The query intents mayinclude people (including friends, friends-of-friend, and exploratory),celebrity, place, page, and keyword/topic. Although this functionalitymay be used in the typeahead and structured query contexts, it may alsobe used for unstructured keyword searches. The query intent may bedetermined in a variety of ways. In some embodiments, the intent may bedetermined by combining a keyword search and an entity search. In someembodiments, the intent may be determined based on the results from atopic tagger. For example, if lots of users are identified, this it islikely a people search; if lots of posts are pulled, then it is likely atopic search. The information may be combined by scoring and ranking theinformation. If the social-networking system determines that there is amatch between the results from the topic tagger and the entity search,then those matches provide strong signals that define the intent of thequery as being a topic query for that particular topic. However, if thesocial-networking system determine there is no topic match, thendistribution may be used along the entity results in combination withtext estimation. Text estimation is a language-model based textestimation of the classification for the query based on named entitieswithin the social graph and not necessarily based on the query the userenters. The social-networking system may use text estimation and theactual entity search results to determine query intent. In someembodiments, search results which the user is more likely to click,based on the intent of the search query, may be provided to the user fordisplay.

In an exemplary embodiment, a method may include accessing a socialgraph. The social graph may include a plurality of nodes and a pluralityof edges connecting the nodes. Each of the edges between two of thenodes may represent a single degree of separation between them. Thenodes may include a first node corresponding to a first user associatedwith an online social network and a plurality of second nodes that eachcorrespond to a concept or a second user associated with the onlinesocial network. The method may include receiving from a client system ofthe first user a search query. The method may include identifying one ormore second nodes that match the search query. The method may includegenerating one or more search results corresponding to the search query.The search results may be generated based on the determined searchintents of the search query. Each search result may include a referenceto one of the identified second nodes. The method may include sending asearch-results page to the client system of the first user for display.The search-results page may be sent responsive to receiving the searchquery. The search-results page may include one or more of the generatedsearch results.

The embodiments disclosed above are only examples, and the scope of thisdisclosure is not limited to them. Particular embodiments may includeall, some, or none of the components, elements, features, functions,operations, or steps of the embodiments disclosed above. Embodimentsaccording to the invention are in particular disclosed in the attachedclaims directed to a method, a storage medium, a system and a computerprogram product, wherein any feature mentioned in one claim category,e.g. method, may be claimed in another claim category, e.g. system, aswell. The dependencies or references back in the attached claims arechosen for formal reasons only. However any subject matter resultingfrom a deliberate reference back to any previous claims (in particularmultiple dependencies) may be claimed as well, so that any combinationof claims and the features thereof are disclosed and may be claimedregardless of the dependencies chosen in the attached claims. Thesubject-matter which may be claimed comprises not only the combinationsof features as set out in the attached claims but also any othercombination of features in the claims, wherein each feature mentioned inthe claims may be combined with any other feature or combination ofother features in the claims. Furthermore, any of the embodiments andfeatures described or depicted herein may be claimed in a separate claimand/or in any combination with any embodiment or feature described ordepicted herein or with any of the features of the attached claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an example network environment associated with asocial-networking system.

FIG. 2 illustrates an example social graph.

FIG. 3 illustrates an example page of an online social network.

FIGS. 4A-4B illustrate example queries of the social network.

FIG. 5 illustrates example customized keyword completion suggestions ofthe social network.

FIG. 6 illustrates an example method for providing customized keywordcompletion suggestions.

FIGS. 7A-7D illustrate example search-results pages of the socialnetwork.

FIGS. 8A-8D illustrate additional example search-results pages of thesocial network.

FIG. 9 illustrates an example method for determining the intent of asearch query.

FIG. 10 illustrates an example computer system.

DESCRIPTION OF EXAMPLE EMBODIMENTS

System Overview

FIG. 1 illustrates an example network environment 100 associated with asocial-networking system. Network environment 100 includes a clientsystem 130, a social-networking system 160, and a third-party system 170connected to each other by a network 110. Although FIG. 1 illustrates aparticular arrangement of client system 130, social-networking system160, third-party system 170, and network 110, this disclosurecontemplates any suitable arrangement of client system 130,social-networking system 160, third-party system 170, and network 110.As an example and not by way of limitation, two or more of client system130, social-networking system 160, and third-party system 170 may beconnected to each other directly, bypassing network 110. As anotherexample, two or more of client system 130, social-networking system 160,and third-party system 170 may be physically or logically co-locatedwith each other in whole or in part. Moreover, although FIG. 1illustrates a particular number of client systems 130, social-networkingsystems 160, third-party systems 170, and networks 110, this disclosurecontemplates any suitable number of client systems 130,social-networking systems 160, third-party systems 170, and networks110. As an example and not by way of limitation, network environment 100may include multiple client system 130, social-networking systems 160,third-party systems 170, and networks 110.

This disclosure contemplates any suitable network 110. As an example andnot by way of limitation, one or more portions of network 110 mayinclude an ad hoc network, an intranet, an extranet, a virtual privatenetwork (VPN), a local area network (LAN), a wireless LAN (WLAN), a widearea network (WAN), a wireless WAN (WWAN), a metropolitan area network(MAN), a portion of the Internet, a portion of the Public SwitchedTelephone Network (PSTN), a cellular telephone network, or a combinationof two or more of these. Network 110 may include one or more networks110.

Links 150 may connect client system 130, social-networking system 160,and third-party system 170 to communication network 110 or to eachother. This disclosure contemplates any suitable links 150. Inparticular embodiments, one or more links 150 include one or morewireline (such as for example Digital Subscriber Line (DSL) or Data OverCable Service Interface Specification (DOC SIS)), wireless (such as forexample Wi-Fi or Worldwide Interoperability for Microwave Access(WiMAX)), or optical (such as for example Synchronous Optical Network(SONET) or Synchronous Digital Hierarchy (SDH)) links. In particularembodiments, one or more links 150 each include an ad hoc network, anintranet, an extranet, a VPN, a LAN, a WLAN, a WAN, a WWAN, a MAN, aportion of the Internet, a portion of the PSTN, a cellulartechnology-based network, a satellite communications technology-basednetwork, another link 150, or a combination of two or more such links150. Links 150 need not necessarily be the same throughout networkenvironment 100. One or more first links 150 may differ in one or morerespects from one or more second links 150.

In particular embodiments, client system 130 may be an electronic deviceincluding hardware, software, or embedded logic components or acombination of two or more such components and capable of carrying outthe appropriate functionalities implemented or supported by clientsystem 130. As an example and not by way of limitation, a client system130 may include a computer system such as a desktop computer, notebookor laptop computer, netbook, a tablet computer, e-book reader, GPSdevice, camera, personal digital assistant (PDA), handheld electronicdevice, cellular telephone, smartphone, other suitable electronicdevice, or any suitable combination thereof. This disclosurecontemplates any suitable client systems 130. A client system 130 mayenable a network user at client system 130 to access network 110. Aclient system 130 may enable its user to communicate with other users atother client systems 130.

In particular embodiments, client system 130 may include a web browser132, such as MICROSOFT INTERNET EXPLORER, GOOGLE CHROME or MOZILLAFIREFOX, and may have one or more add-ons, plug-ins, or otherextensions, such as TOOLBAR or YAHOO TOOLBAR. A user at client system130 may enter a Uniform Resource Locator (URL) or other addressdirecting the web browser 132 to a particular server (such as server162, or a server associated with a third-party system 170), and the webbrowser 132 may generate a Hyper Text Transfer Protocol (HTTP) requestand communicate the HTTP request to server. The server may accept theHTTP request and communicate to client system 130 one or more Hyper TextMarkup Language (HTML) files responsive to the HTTP request. Clientsystem 130 may render a webpage based on the HTML files from the serverfor presentation to the user. This disclosure contemplates any suitablewebpage files. As an example and not by way of limitation, webpages mayrender from HTML files, Extensible Hyper Text Markup Language (XHTML)files, or Extensible Markup Language (XML) files, according toparticular needs. Such pages may also execute scripts such as, forexample and without limitation, those written in JAVASCRIPT, JAVA,MICROSOFT SILVERLIGHT, combinations of markup language and scripts suchas AJAX (Asynchronous JAVASCRIPT and XML), and the like. Herein,reference to a webpage encompasses one or more corresponding webpagefiles (which a browser may use to render the webpage) and vice versa,where appropriate.

In particular embodiments, social-networking system 160 may be anetwork-addressable computing system that can host an online socialnetwork. Social-networking system 160 may generate, store, receive, andsend social-networking data, such as, for example, user-profile data,concept-profile data, social-graph information, or other suitable datarelated to the online social network. Social-networking system 160 maybe accessed by the other components of network environment 100 eitherdirectly or via network 110. As an example and not by way of limitation,client system 130 may access social-networking system 160 using a webbrowser 132, or a native application associated with social-networkingsystem 160 (e.g., a mobile social-networking application, a messagingapplication, another suitable application, or any combination thereof)either directly or via network 110. In particular embodiments,social-networking system 160 may include one or more servers 162. Eachserver 162 may be a unitary server or a distributed server spanningmultiple computers or multiple datacenters. Servers 162 may be ofvarious types, such as, for example and without limitation, web server,news server, mail server, message server, advertising server, fileserver, application server, exchange server, database server, proxyserver, another server suitable for performing functions or processesdescribed herein, or any combination thereof. In particular embodiments,each server 162 may include hardware, software, or embedded logiccomponents or a combination of two or more such components for carryingout the appropriate functionalities implemented or supported by server162. In particular embodiments, social-networking system 160 may includeone or more data stores 164. Data stores 164 may be used to storevarious types of information. In particular embodiments, the informationstored in data stores 164 may be organized according to specific datastructures. In particular embodiments, each data store 164 may be arelational, columnar, correlation, or other suitable database. Althoughthis disclosure describes or illustrates particular types of databases,this disclosure contemplates any suitable types of databases. Particularembodiments may provide interfaces that enable a client system 130, asocial-networking system 160, or a third-party system 170 to manage,retrieve, modify, add, or delete, the information stored in data store164.

In particular embodiments, social-networking system 160 may store one ormore social graphs in one or more data stores 164. In particularembodiments, a social graph may include multiple nodes—which may includemultiple user nodes (each corresponding to a particular user) ormultiple concept nodes (each corresponding to a particular concept)—andmultiple edges connecting the nodes. Social-networking system 160 mayprovide users of the online social network the ability to communicateand interact with other users. In particular embodiments, users may jointhe online social network via social-networking system 160 and then addconnections (e.g., relationships) to a number of other users ofsocial-networking system 160 whom they want to be connected to. Herein,the term “friend” may refer to any other user of social-networkingsystem 160 with whom a user has formed a connection, association, orrelationship via social-networking system 160.

In particular embodiments, social-networking system 160 may provideusers with the ability to take actions on various types of items orobjects, supported by social-networking system 160. As an example andnot by way of limitation, the items and objects may include groups orsocial networks to which users of social-networking system 160 maybelong, events or calendar entries in which a user might be interested,computer-based applications that a user may use, transactions that allowusers to buy or sell items via the service, interactions withadvertisements that a user may perform, or other suitable items orobjects. A user may interact with anything that is capable of beingrepresented in social-networking system 160 or by an external system ofthird-party system 170, which is separate from social-networking system160 and coupled to social-networking system 160 via a network 110.

In particular embodiments, social-networking system 160 may be capableof linking a variety of entities. As an example and not by way oflimitation, social-networking system 160 may enable users to interactwith each other as well as receive content from third-party systems 170or other entities, or to allow users to interact with these entitiesthrough an application programming interfaces (API) or othercommunication channels.

In particular embodiments, a third-party system 170 may include one ormore types of servers, one or more data stores, one or more interfaces,including but not limited to APIs, one or more web services, one or morecontent sources, one or more networks, or any other suitable components,e.g., that servers may communicate with. A third-party system 170 may beoperated by a different entity from an entity operatingsocial-networking system 160. In particular embodiments, however,social-networking system 160 and third-party systems 170 may operate inconjunction with each other to provide social-networking services tousers of social-networking system 160 or third-party systems 170. Inthis sense, social-networking system 160 may provide a platform, orbackbone, which other systems, such as third-party systems 170, may useto provide social-networking services and functionality to users acrossthe Internet.

In particular embodiments, a third-party system 170 may include athird-party content object provider. A third-party content objectprovider may include one or more sources of content objects, which maybe communicated to a client system 130. As an example and not by way oflimitation, content objects may include information regarding things oractivities of interest to the user, such as, for example, movie showtimes, movie reviews, restaurant reviews, restaurant menus, productinformation and reviews, or other suitable information. As anotherexample and not by way of limitation, content objects may includeincentive content objects, such as coupons, discount tickets, giftcertificates, or other suitable incentive objects.

In particular embodiments, social-networking system 160 also includesuser-generated content objects, which may enhance a user's interactionswith social-networking system 160. User-generated content may includeanything a user can add, upload, send, or “post” to social-networkingsystem 160. As an example and not by way of limitation, a usercommunicates posts to social-networking system 160 from a client system130. Posts may include data such as status updates or other textualdata, location information, photos, videos, links, music or othersimilar data or media. Content may also be added to social-networkingsystem 160 by a third-party through a “communication channel,” such as anewsfeed or stream.

In particular embodiments, social-networking system 160 may include avariety of servers, sub-systems, programs, modules, logs, and datastores. In particular embodiments, social-networking system 160 mayinclude one or more of the following: a web server, action logger,API-request server, relevance-and-ranking engine, content-objectclassifier, notification controller, action log,third-party-content-object-exposure log, inference module,authorization/privacy server, search module, advertisement-targetingmodule, user-interface module, user-profile store, connection store,third-party content store, or location store. Social-networking system160 may also include suitable components such as network interfaces,security mechanisms, load balancers, failover servers,management-and-network-operations consoles, other suitable components,or any suitable combination thereof. In particular embodiments,social-networking system 160 may include one or more user-profile storesfor storing user profiles. A user profile may include, for example,biographic information, demographic information, behavioral information,social information, or other types of descriptive information, such aswork experience, educational history, hobbies or preferences, interests,affinities, or location. Interest information may include interestsrelated to one or more categories. Categories may be general orspecific. As an example and not by way of limitation, if a user “likes”an article about a brand of shoes the category may be the brand, or thegeneral category of “shoes” or “clothing.” A connection store may beused for storing connection information about users. The connectioninformation may indicate users who have similar or common workexperience, group memberships, hobbies, educational history, or are inany way related or share common attributes. The connection informationmay also include user-defined connections between different users andcontent (both internal and external). A web server may be used forlinking social-networking system 160 to one or more client systems 130or one or more third-party system 170 via network 110. The web servermay include a mail server or other messaging functionality for receivingand routing messages between social-networking system 160 and one ormore client systems 130. An API-request server may allow a third-partysystem 170 to access information from social-networking system 160 bycalling one or more APIs. An action logger may be used to receivecommunications from a web server about a user's actions on or offsocial-networking system 160. In conjunction with the action log, athird-party-content-object log may be maintained of user exposures tothird-party-content objects. A notification controller may provideinformation regarding content objects to a client system 130.Information may be pushed to a client system 130 as notifications, orinformation may be pulled from client system 130 responsive to a requestreceived from client system 130. Authorization servers may be used toenforce one or more privacy settings of the users of social-networkingsystem 160. A privacy setting of a user determines how particularinformation associated with a user can be shared. The authorizationserver may allow users to opt in to or opt out of having their actionslogged by social-networking system 160 or shared with other systems(e.g., third-party system 170), such as, for example, by settingappropriate privacy settings. Third-party-content-object stores may beused to store content objects received from third parties, such as athird-party system 170. Location stores may be used for storing locationinformation received from client systems 130 associated with users.Advertisement-pricing modules may combine social information, thecurrent time, location information, or other suitable information toprovide relevant advertisements, in the form of notifications, to auser.

Social Graphs

FIG. 2 illustrates example social graph 200. In particular embodiments,social-networking system 160 may store one or more social graphs 200 inone or more data stores. In particular embodiments, social graph 200 mayinclude multiple nodes—which may include multiple user nodes 202 ormultiple concept nodes 204—and multiple edges 206 connecting the nodes.Example social graph 200 illustrated in FIG. 2 is shown, for didacticpurposes, in a two-dimensional visual map representation. In particularembodiments, a social-networking system 160, client system 130, orthird-party system 170 may access social graph 200 and relatedsocial-graph information for suitable applications. The nodes and edgesof social graph 200 may be stored as data objects, for example, in adata store (such as a social-graph database). Such a data store mayinclude one or more searchable or queryable indexes of nodes or edges ofsocial graph 200.

In particular embodiments, a user node 202 may correspond to a user ofsocial-networking system 160. As an example and not by way oflimitation, a user may be an individual (human user), an entity (e.g.,an enterprise, business, or third-party application), or a group (e.g.,of individuals or entities) that interacts or communicates with or oversocial-networking system 160. In particular embodiments, when a userregisters for an account with social-networking system 160,social-networking system 160 may create a user node 202 corresponding tothe user, and store the user node 202 in one or more data stores. Usersand user nodes 202 described herein may, where appropriate, refer toregistered users and user nodes 202 associated with registered users. Inaddition or as an alternative, users and user nodes 202 described hereinmay, where appropriate, refer to users that have not registered withsocial-networking system 160. In particular embodiments, a user node 202may be associated with information provided by a user or informationgathered by various systems, including social-networking system 160. Asan example and not by way of limitation, a user may provide his or hername, profile picture, contact information, birth date, sex, maritalstatus, family status, employment, education background, preferences,interests, or other demographic information. In particular embodiments,a user node 202 may be associated with one or more data objectscorresponding to information associated with a user. In particularembodiments, a user node 202 may correspond to one or more webpages.

In particular embodiments, a concept node 204 may correspond to aconcept. As an example and not by way of limitation, a concept maycorrespond to a place (such as, for example, a movie theater,restaurant, landmark, or city); a website (such as, for example, awebsite associated with social-network system 160 or a third-partywebsite associated with a web-application server); an entity (such as,for example, a person, business, group, sports team, or celebrity); aresource (such as, for example, an audio file, video file, digitalphoto, text file, structured document, or application) which may belocated within social-networking system 160 or on an external server,such as a web-application server; real or intellectual property (suchas, for example, a sculpture, painting, movie, game, song, idea,photograph, or written work); a game; an activity; an idea or theory;another suitable concept; or two or more such concepts. A concept node204 may be associated with information of a concept provided by a useror information gathered by various systems, including social-networkingsystem 160. As an example and not by way of limitation, information of aconcept may include a name or a title; one or more images (e.g., animage of the cover page of a book); a location (e.g., an address or ageographical location); a website (which may be associated with a URL);contact information (e.g., a phone number or an email address); othersuitable concept information; or any suitable combination of suchinformation. In particular embodiments, a concept node 204 may beassociated with one or more data objects corresponding to informationassociated with concept node 204. In particular embodiments, a conceptnode 204 may correspond to one or more webpages.

In particular embodiments, a node in social graph 200 may represent orbe represented by a webpage (which may be referred to as a “profilepage”). Profile pages may be hosted by or accessible tosocial-networking system 160. Profile pages may also be hosted onthird-party websites associated with a third-party server 170. As anexample and not by way of limitation, a profile page corresponding to aparticular external webpage may be the particular external webpage andthe profile page may correspond to a particular concept node 204.Profile pages may be viewable by all or a selected subset of otherusers. As an example and not by way of limitation, a user node 202 mayhave a corresponding user-profile page in which the corresponding usermay add content, make declarations, or otherwise express himself orherself. As another example and not by way of limitation, a concept node204 may have a corresponding concept-profile page in which one or moreusers may add content, make declarations, or express themselves,particularly in relation to the concept corresponding to concept node204.

In particular embodiments, a concept node 204 may represent athird-party webpage or resource hosted by a third-party system 170. Thethird-party webpage or resource may include, among other elements,content, a selectable or other icon, or other inter-actable object(which may be implemented, for example, in JavaScript, AJAX, or PHPcodes) representing an action or activity. As an example and not by wayof limitation, a third-party webpage may include a selectable icon suchas “like,” “check-in,” “eat,” “recommend,” or another suitable action oractivity. A user viewing the third-party webpage may perform an actionby selecting one of the icons (e.g., “check-in”), causing a clientsystem 130 to send to social-networking system 160 a message indicatingthe user's action. In response to the message, social-networking system160 may create an edge (e.g., a check-in-type edge) between a user node202 corresponding to the user and a concept node 204 corresponding tothe third-party webpage or resource and store edge 206 in one or moredata stores.

In particular embodiments, a pair of nodes in social graph 200 may beconnected to each other by one or more edges 206. An edge 206 connectinga pair of nodes may represent a relationship between the pair of nodes.In particular embodiments, an edge 206 may include or represent one ormore data objects or attributes corresponding to the relationshipbetween a pair of nodes. As an example and not by way of limitation, afirst user may indicate that a second user is a “friend” of the firstuser. In response to this indication, social-networking system 160 maysend a “friend request” to the second user. If the second user confirmsthe “friend request,” social-networking system 160 may create an edge206 connecting the first user's user node 202 to the second user's usernode 202 in social graph 200 and store edge 206 as social-graphinformation in one or more of data stores 164. In the example of FIG. 2,social graph 200 includes an edge 206 indicating a friend relationbetween user nodes 202 of user “A” and user “B” and an edge indicating afriend relation between user nodes 202 of user “C” and user “B.”Although this disclosure describes or illustrates particular edges 206with particular attributes connecting particular user nodes 202, thisdisclosure contemplates any suitable edges 206 with any suitableattributes connecting user nodes 202. As an example and not by way oflimitation, an edge 206 may represent a friendship, family relationship,business or employment relationship, fan relationship (including, e.g.,liking, etc.), follower relationship, visitor relationship (including,e.g., accessing, viewing, checking-in, sharing, etc.), subscriberrelationship, superior/subordinate relationship, reciprocalrelationship, non-reciprocal relationship, another suitable type ofrelationship, or two or more such relationships. Moreover, although thisdisclosure generally describes nodes as being connected, this disclosurealso describes users or concepts as being connected. Herein, referencesto users or concepts being connected may, where appropriate, refer tothe nodes corresponding to those users or concepts being connected insocial graph 200 by one or more edges 206.

In particular embodiments, an edge 206 between a user node 202 and aconcept node 204 may represent a particular action or activity performedby a user associated with user node 202 toward a concept associated witha concept node 204. As an example and not by way of limitation, asillustrated in FIG. 2, a user may “like,” “attended,” “played,”“listened,” “cooked,” “worked at,” or “watched” a concept, each of whichmay correspond to an edge type or subtype. A concept-profile pagecorresponding to a concept node 204 may include, for example, aselectable “check in” icon (such as, for example, a clickable “check in”icon) or a selectable “add to favorites” icon. Similarly, after a userclicks these icons, social-networking system 160 may create a “favorite”edge or a “check in” edge in response to a user's action correspondingto a respective action. As another example and not by way of limitation,a user (user “C”) may listen to a particular song (“Imagine”) using aparticular application (SPOTIFY, which is an online music application).In this case, social-networking system 160 may create a “listened” edge206 and a “used” edge (as illustrated in FIG. 2) between user nodes 202corresponding to the user and concept nodes 204 corresponding to thesong and application to indicate that the user listened to the song andused the application. Moreover, social-networking system 160 may createa “played” edge 206 (as illustrated in FIG. 2) between concept nodes 204corresponding to the song and the application to indicate that theparticular song was played by the particular application. In this case,“played” edge 206 corresponds to an action performed by an externalapplication (SPOTIFY) on an external audio file (the song “Imagine”).Although this disclosure describes particular edges 206 with particularattributes connecting user nodes 202 and concept nodes 204, thisdisclosure contemplates any suitable edges 206 with any suitableattributes connecting user nodes 202 and concept nodes 204. Moreover,although this disclosure describes edges between a user node 202 and aconcept node 204 representing a single relationship, this disclosurecontemplates edges between a user node 202 and a concept node 204representing one or more relationships. As an example and not by way oflimitation, an edge 206 may represent both that a user likes and hasused at a particular concept. Alternatively, another edge 206 mayrepresent each type of relationship (or multiples of a singlerelationship) between a user node 202 and a concept node 204 (asillustrated in FIG. 2 between user node 202 for user “E” and conceptnode 204 for “SPOTIFY”).

In particular embodiments, social-networking system 160 may create anedge 206 between a user node 202 and a concept node 204 in social graph200. As an example and not by way of limitation, a user viewing aconcept-profile page (such as, for example, by using a web browser or aspecial-purpose application hosted by the user's client system 130) mayindicate that he or she likes the concept represented by the conceptnode 204 by clicking or selecting a “Like” icon, which may cause theuser's client system 130 to send to social-networking system 160 amessage indicating the user's liking of the concept associated with theconcept-profile page. In response to the message, social-networkingsystem 160 may create an edge 206 between user node 202 associated withthe user and concept node 204, as illustrated by “like” edge 206 betweenthe user and concept node 204. In particular embodiments,social-networking system 160 may store an edge 206 in one or more datastores. In particular embodiments, an edge 206 may be automaticallyformed by social-networking system 160 in response to a particular useraction. As an example and not by way of limitation, if a first useruploads a picture, watches a movie, or listens to a song, an edge 206may be formed between user node 202 corresponding to the first user andconcept nodes 204 corresponding to those concepts. Although thisdisclosure describes forming particular edges 206 in particular manners,this disclosure contemplates forming any suitable edges 206 in anysuitable manner.

Typeahead Processes

In particular embodiments, one or more client-side and/or backend(server-side) processes may implement and utilize a “typeahead” featurethat may automatically attempt to match social-graph elements (e.g.,user nodes 202, concept nodes 204, or edges 206) to informationcurrently being entered by a user in an input form rendered inconjunction with a requested page (such as, for example, a user-profilepage, a concept-profile page, a search-results page, a user interface ofa native application associated with the online social network, oranother suitable page of the online social network), which may be hostedby or accessible in the social-networking system 160. In particularembodiments, as a user is entering text to make a declaration, thetypeahead feature may attempt to match the string of textual charactersbeing entered in the declaration to strings of characters (e.g., names,descriptions) corresponding to users, concepts, or edges and theircorresponding elements in the social graph 200. In particularembodiments, when a match is found, the typeahead feature mayautomatically populate the form with a reference to the social-graphelement (such as, for example, the node name/type, node ID, edgename/type, edge ID, or another suitable reference or identifier) of theexisting social-graph element.

In particular embodiments, as a user types or otherwise enters text intoa form used to add content or make declarations in various sections ofthe user's profile page, home page, or other page, the typeahead processmay work in conjunction with one or more frontend (client-side) and/orbackend (server-side) typeahead processes (hereinafter referred tosimply as “typeahead process”) executing at (or within) thesocial-networking system 160 (e.g., within servers 162), tointeractively and virtually instantaneously (as appearing to the user)attempt to auto-populate the form with a term or terms corresponding tonames of existing social-graph elements, or terms associated withexisting social-graph elements, determined to be the most relevant orbest match to the characters of text entered by the user as the userenters the characters of text. Utilizing the social-graph information ina social-graph database or information extracted and indexed from thesocial-graph database, including information associated with nodes andedges, the typeahead processes, in conjunction with the information fromthe social-graph database, as well as potentially in conjunction withvarious others processes, applications, or databases located within orexecuting within social-networking system 160, may be able to predict auser's intended declaration with a high degree of precision. However,the social-networking system 160 can also provides user's with thefreedom to enter essentially any declaration they wish, enabling usersto express themselves freely.

In particular embodiments, as a user enters text characters into a formbox or other field, the typeahead processes may attempt to identifyexisting social-graph elements (e.g., user nodes 202, concept nodes 204,or edges 206) that match the string of characters entered in the user'sdeclaration as the user is entering the characters. In particularembodiments, as the user enters characters into a form box, thetypeahead process may read the string of entered textual characters. Aseach keystroke is made, the frontend-typeahead process may send theentered character string as a request (or call) to the backend-typeaheadprocess executing within social-networking system 160. In particularembodiments, the typeahead processes may communicate via AJAX(Asynchronous JavaScript and XML) or other suitable techniques, andparticularly, asynchronous techniques. In particular embodiments, therequest may be, or comprise, an XMLHTTPRequest (XHR) enabling quick anddynamic sending and fetching of results. In particular embodiments, thetypeahead process may also send before, after, or with the request asection identifier (section ID) that identifies the particular sectionof the particular page in which the user is making the declaration. Inparticular embodiments, a user ID parameter may also be sent, but thismay be unnecessary in some embodiments, as the user may already be“known” based on the user having logged into (or otherwise beenauthenticated by) the social-networking system 160.

In particular embodiments, the typeahead process may use one or morematching algorithms to attempt to identify matching social-graphelements. In particular embodiments, when a match or matches are found,the typeahead process may send a response (which may utilize AJAX orother suitable techniques) to the user's client system 130 that mayinclude, for example, the names (name strings) or descriptions of thematching social-graph elements as well as, potentially, other metadataassociated with the matching social-graph elements. As an example andnot by way of limitation, if a user entering the characters “pok” into aquery field, the typeahead process may display a drop-down menu thatdisplays names of matching existing profile pages and respective usernodes 202 or concept nodes 204, such as a profile page named or devotedto “poker” or “pokemon”, which the user can then click on or otherwiseselect thereby confirming the desire to declare the matched user orconcept name corresponding to the selected node. As another example andnot by way of limitation, upon clicking “poker,” the typeahead processmay auto-populate, or causes the web browser 132 to auto-populate, thequery field with the declaration “poker”. In particular embodiments, thetypeahead process may simply auto-populate the field with the name orother identifier of the top-ranked match rather than display a drop-downmenu. The user may then confirm the auto-populated declaration simply bykeying “enter” on his or her keyboard or by clicking on theauto-populated declaration.

More information on typeahead processes may be found in U.S. patentapplication Ser. No. 12/763,162, filed 19 Apr. 2010, and U.S. patentapplication Ser. No. 13/556,072, filed 23 Jul. 2012, which areincorporated by reference.

Structured Search Queries

FIG. 3 illustrates an example page of an online social network. Inparticular embodiments, a user may submit a query to thesocial-networking system 160 by inputting text into query field 350. Auser of an online social network may search for information relating toa specific subject matter (e.g., users, concepts, external content orresource) by providing a short phrase describing the subject matter,often referred to as a “search query,” to a search engine. The query maybe an unstructured text query and may comprise one or more text strings(which may include one or more n-grams). In general, a user may inputany character string into query field 350 to search for content on thesocial-networking system 160 that matches the text query. Thesocial-networking system 160 may then search a data store 164 (or, inparticular, a social-graph database) to identify content matching thequery. The search engine may conduct a search based on the query phraseusing various search algorithms and generate search results thatidentify resources or content (e.g., user-profile pages, content-profilepages, or external resources) that are most likely to be related to thesearch query. To conduct a search, a user may input or send a searchquery to the search engine. In response, the search engine may identifyone or more resources that are likely to be related to the search query,each of which may individually be referred to as a “search result,” orcollectively be referred to as the “search results” corresponding to thesearch query. The identified content may include, for example,social-graph elements (i.e., user nodes 202, concept nodes 204, edges206), profile pages, external webpages, or any combination thereof. Thesocial-networking system 160 may then generate a search-results pagewith search results corresponding to the identified content and send thesearch-results page to the user. The search results may be presented tothe user, often in the form of a list of links on the search-resultspage, each link being associated with a different page that containssome of the identified resources or content. In particular embodiments,each link in the search results may be in the form of a Uniform ResourceLocator (URL) that specifies where the corresponding page is located andthe mechanism for retrieving it. The social-networking system 160 maythen send the search-results page to the web browser 132 on the user'sclient system 130. The user may then click on the URL links or otherwiseselect the content from the search-results page to access the contentfrom the social-networking system 160 or from an external system (suchas, for example, a third-party system 170), as appropriate. Theresources may be ranked and presented to the user according to theirrelative degrees of relevance to the search query. The search resultsmay also be ranked and presented to the user according to their relativedegree of relevance to the user. In other words, the search results maybe personalized for the querying user based on, for example,social-graph information, user information, search or browsing historyof the user, or other suitable information related to the user. Inparticular embodiments, ranking of the resources may be determined by aranking algorithm implemented by the search engine. As an example andnot by way of limitation, resources that are more relevant to the searchquery or to the user may be ranked higher than the resources that areless relevant to the search query or the user. In particularembodiments, the search engine may limit its search to resources andcontent on the online social network. However, in particularembodiments, the search engine may also search for resources or contentson other sources, such as a third-party system 170, the internet orWorld Wide Web, or other suitable sources. Although this disclosuredescribes querying the social-networking system 160 in a particularmanner, this disclosure contemplates querying the social-networkingsystem 160 in any suitable manner.

In particular embodiments, the typeahead processes described herein maybe applied to search queries entered by a user. As an example and not byway of limitation, as a user enters text characters into a query field350, a typeahead process may attempt to identify one or more user nodes202, concept nodes 204, or edges 206 that match the string of charactersentered into query field 350 as the user is entering the characters. Asthe typeahead process receives requests or calls including a string orn-gram from the text query, the typeahead process may perform or causesto be performed a search to identify existing social-graph elements(i.e., user nodes 202, concept nodes 204, edges 206) having respectivenames, types, categories, or other identifiers matching the enteredtext. The typeahead process may use one or more matching algorithms toattempt to identify matching nodes or edges. When a match or matches arefound, the typeahead process may send a response to the user's clientsystem 130 that may include, for example, the names (name strings) ofthe matching nodes as well as, potentially, other metadata associatedwith the matching nodes. The typeahead process may then display adrop-down menu 300 that displays names of matching existing profilepages and respective user nodes 202 or concept nodes 204, and displaysnames of matching edges 206 that may connect to the matching user nodes202 or concept nodes 204, which the user can then click on or otherwiseselect thereby confirming the desire to search for the matched user orconcept name corresponding to the selected node, or to search for usersor concepts connected to the matched users or concepts by the matchingedges. Alternatively, the typeahead process may simply auto-populate theform with the name or other identifier of the top-ranked match ratherthan display a drop-down menu 300. The user may then confirm theauto-populated declaration simply by keying “enter” on a keyboard or byclicking on the auto-populated declaration. Upon user confirmation ofthe matching nodes and edges, the typeahead process may send a requestthat informs the social-networking system 160 of the user's confirmationof a query containing the matching social-graph elements. In response tothe request sent, the social-networking system 160 may automatically (oralternately based on an instruction in the request) call or otherwisesearch a social-graph database for the matching social-graph elements,or for social-graph elements connected to the matching social-graphelements as appropriate. Although this disclosure describes applying thetypeahead processes to search queries in a particular manner, thisdisclosure contemplates applying the typeahead processes to searchqueries in any suitable manner.

In connection with search queries and search results, particularembodiments may utilize one or more systems, components, elements,functions, methods, operations, or steps disclosed in U.S. patentapplication Ser. No. 11/503,093, filed 11 Aug. 2006, U.S. patentapplication Ser. No. 12/977,027, filed 22 Dec. 2010, and U.S. patentapplication Ser. No. 12/978,265, filed 23 Dec. 2010, which areincorporated by reference.

Element Detection and Parsing Ambiguous Terms

FIGS. 4A-4B illustrate example queries of the social network. Inparticular embodiments, in response to a text query received from afirst user (i.e., the querying user), the social-networking system 160may parse the text query and identify portions of the text query thatcorrespond to particular social-graph elements. However, in some cases aquery may include one or more terms that are ambiguous, where anambiguous term is a term that may possibly correspond to multiplesocial-graph elements. To parse the ambiguous term, thesocial-networking system 160 may access a social graph 200 and thenparse the text query to identify the social-graph elements thatcorresponded to ambiguous n-grams from the text query. Thesocial-networking system 160 may then generate a set of structuredqueries, where each structured query corresponds to one of the possiblematching social-graph elements. These structured queries may be based onstrings generated by a grammar model, such that they are rendered in anatural-language syntax with references to the relevant social-graphelements. These structured queries may be presented to the queryinguser, who can then select among the structured queries to indicate whichsocial-graph element the querying user intended to reference with theambiguous term. In response to the querying user's selection, thesocial-networking system 160 may then lock the ambiguous term in thequery to the social-graph element selected by the querying user, andthen generate a new set of structured queries based on the selectedsocial-graph element. FIGS. 4A-4B illustrate various example textqueries in query field 350 and various structured queries generated inresponse in drop-down menus 300 (although other suitable graphical userinterfaces are possible). By providing suggested structured queries inresponse to a user's text query, the social-networking system 160 mayprovide a powerful way for users of the online social network to searchfor elements represented in the social graph 200 based on theirsocial-graph attributes and their relation to various social-graphelements. Structured queries may allow a querying user to search forcontent that is connected to particular users or concepts in the socialgraph 200 by particular edge-types. The structured queries may be sentto the first user and displayed in a drop-down menu 300 (via, forexample, a client-side typeahead process), where the first user can thenselect an appropriate query to search for the desired content. Some ofthe advantages of using the structured queries described herein includefinding users of the online social network based upon limitedinformation, bringing together virtual indexes of content from theonline social network based on the relation of that content to varioussocial-graph elements, or finding content related to you and/or yourfriends. Although this disclosure describes and FIGS. 4A-4B illustrategenerating particular structured queries in a particular manner, thisdisclosure contemplates generating any suitable structured queries inany suitable manner.

In particular embodiments, the social-networking system 160 may receivefrom a querying/first user (corresponding to a first user node 202) anunstructured text query. As an example and not by way of limitation, afirst user may want to search for other users who: (1) are first-degreefriends of the first user; and (2) are associated with StanfordUniversity (i.e., the user nodes 202 are connected by an edge 206 to theconcept node 204 corresponding to the school “Stanford”). The first usermay then enter a text query “friends stanford” into query field 350, asillustrated in FIGS. 4A-4B. As the querying user enters this text queryinto query field 350, the social-networking system 160 may providevarious suggested structured queries, as illustrated in drop-down menus300. As used herein, an unstructured text query refers to a simple textstring inputted by a user. The text query may, of course, be structuredwith respect to standard language/grammar rules (e.g. English languagegrammar). However, the text query will ordinarily be unstructured withrespect to social-graph elements. In other words, a simple text querywill not ordinarily include embedded references to particularsocial-graph elements. Thus, as used herein, a structured query refersto a query that contains references to particular social-graph elements,allowing the search engine to search based on the identified elements.Furthermore, the text query may be unstructured with respect to formalquery syntax. In other words, a simple text query will not necessarilybe in the format of a query command that is directly executable by asearch engine (e.g., the text query “friends stanford” could be parsedto form the query command “intersect(school(Stanford University),friends(me)”, or “/search/me/friends/[node ID for StanfordUniversity]/students/ever-past/intersect”, which could be executed as aquery in a social-graph database). Although this disclosure describesreceiving particular queries in a particular manner, this disclosurecontemplates receiving any suitable queries in any suitable manner.

In particular embodiments, social-networking system 160 may parse theunstructured text query (also simply referred to as a search query)received from the first user (i.e., the querying user) to identify oneor more n-grams. In general, an n-gram is a contiguous sequence of nitems from a given sequence of text or speech. The items may becharacters, phonemes, syllables, letters, words, base pairs, prefixes,or other identifiable items from the sequence of text or speech. Then-gram may comprise one or more characters of text (letters, numbers,punctuation, etc.) entered by the querying user. An n-gram of size onecan be referred to as a “unigram,” of size two can be referred to as a“bigram” or “digram,” of size three can be referred to as a “trigram,”and so on. Each n-gram may include one or more parts from the text queryreceived from the querying user. In particular embodiments, each n-grammay comprise a character string (e.g., one or more characters of text)entered by the first user. As an example and not by way of limitation,the social-networking system 160 may parse the text query “friendsstanford” to identify the following n-grams: friends; stanford; friendsstanford. As another example and not by way of limitation, thesocial-networking system 160 may parse the text query “friends in paloalto” to identify the following n-grams: friends; in; palo; alto;friends in; in palo; palo alto; friend in palo; in palo alto; friends inpalo alto. In particular embodiments, each n-gram may comprise acontiguous sequence of n items from the text query. Although thisdisclosure describes parsing particular queries in a particular manner,this disclosure contemplates parsing any suitable queries in anysuitable manner.

In particular embodiments, social-networking system 160 may identify aplurality of nodes or a plurality of edges corresponding to one or moreof the n-grams of a text query. Identifying social-graph elements thatcorrespond to an n-gram may be done in a variety of manners, such as,for example, by determining or calculating, for each n-gram identifiedin the text query, a score that the n-gram corresponds to a social-graphelement. The score may be, for example, a confidence score, aprobability, a quality, a ranking, another suitable type of score, orany combination thereof. As an example and not by way of limitation, thesocial-networking system 160 may determine a probability score (alsoreferred to simply as a “probability”) that the n-gram corresponds to asocial-graph element, such as a user node 202, a concept node 204, or anedge 206 of social graph 200. The probability score may indicate thelevel of similarity or relevance between the n-gram and a particularsocial-graph element. There may be many different ways to calculate theprobability. The present disclosure contemplates any suitable method tocalculate a probability score for an n-gram identified in a searchquery. In particular embodiments, the social-networking system 160 maydetermine a probability, p, that an n-gram corresponds to a particularsocial-graph element. The probability, p, may be calculated as theprobability of corresponding to a particular social-graph element, k,given a particular search query, X. In other words, the probability maybe calculated as p=(k|X). As an example and not by way of limitation, aprobability that an n-gram corresponds to a social-graph element maycalculated as an probability score denoted as p_(i,j,k). The input maybe a text query X=(x₁, x₂, . . . , x_(N)), and a set of classes. Foreach (i:j) and a class k, the social-networking system 160 may computep_(i,j,k)=p(class(x_(i:j))=k|X) As an example and not by way oflimitation, the n-gram “stanford” could be scored with respect to thefollowing social-graph elements as follows: school “StanfordUniversity”=0.7; location “Stanford, Calif.”=0.2; user “AllenStanford”=0.1. In this example, because the n-gram “stanford”corresponds to multiple social-graph elements, it may be considered anambiguous n-gram by the social-networking system 160. In other words,the n-gram is not immediately resolvable to a single social-graphelement based on the parsing algorithm used by the social-networkingsystem 160. In particular embodiments, after identifying an ambiguousn-gram, the social-networking system 160 may highlight that n-gram inthe text query to indicate that it may correspond to multiplesocial-graph elements. As an example and not by way of limitation, asillustrated in FIG. 4B the term “Stanford” in query field 350 has beenhighlighted with a dashed-underline to indicate that it may correspondto multiple social-graph elements, as discussed previously. Althoughthis disclosure describes determining whether n-grams correspond tosocial-graph elements in a particular manner, this disclosurecontemplates determining whether n-grams correspond to social-graphelements in any suitable manner. Moreover, although this disclosuredescribes determining whether an n-gram corresponds to a social-graphelement using a particular type of score, this disclosure contemplatesdetermining whether an n-gram corresponds to a social-graph elementusing any suitable type of score.

More information on element detection and parsing queries may be foundin U.S. patent application Ser. No. 13/556,072, filed 23 Jul. 2012, U.S.patent application Ser. No. 13/731,866, filed 31 Dec. 2012, and U.S.patent application Ser. No. 13/732,101, filed 31 Dec. 2012, each ofwhich is incorporated by reference.

Generating Structured Search Queries

In particular embodiments, the social-networking system 160 may access acontext-free grammar model comprising a plurality of grammars. Eachgrammar of the grammar model may comprise one or more non-terminaltokens (or “non-terminal symbols”) and one or more terminal tokens (or“terminal symbols”/“query tokens”), where particular non-terminal tokensmay be replaced by terminal tokens. A grammar model is a set offormation rules for strings in a formal language. Although thisdisclosure describes accessing particular grammars, this disclosurecontemplates any suitable grammars.

In particular embodiments, the social-networking system 160 may generateone or more strings using one or more grammars. To generate a string inthe language, one begins with a string consisting of only a single startsymbol. The production rules are then applied in any order, until astring that contains neither the start symbol nor designatednon-terminal symbols is produced. In a context-free grammar, theproduction of each non-terminal symbol of the grammar is independent ofwhat is produced by other non-terminal symbols of the grammar. Thenon-terminal symbols may be replaced with terminal symbols (i.e.,terminal tokens or query tokens). Some of the query tokens maycorrespond to identified nodes or identified edges, as describedpreviously. A string generated by the grammar may then be used as thebasis for a structured query containing references to the identifiednodes or identified edges. The string generated by the grammar may berendered in a natural-language syntax, such that a structured querybased on the string is also rendered in natural language. A context-freegrammar is a grammar in which the left-hand side of each production ruleconsists of only a single non-terminal symbol. A probabilisticcontext-free grammar is a tuple <Σ,N,S,P>, where the disjoint sets Σ andN specify the terminal and non-terminal symbols, respectively, with S∈Nbeing the start symbol. P is the set of productions, which take the formE→ξ(p), with E∈N, ξ∈(Σ∪N)⁺, and p=Pr(E→ξ), the probability that E willbe expanded into the string ξ. The sum of probabilities p over allexpansions of a given non-terminal E must be one. Although thisdisclosure describes generating strings in a particular manner, thisdisclosure contemplates generating strings in any suitable manner.

In particular embodiments, the social-networking system 160 may generateone or more structured queries. The structured queries may be based onthe natural-language strings generated by one or more grammars, asdescribed previously. Each structured query may include references toone or more of the identified nodes or one or more of the identifiededges 206. This type of structured query may allow the social-networkingsystem 160 to more efficiently search for resources and content relatedto the online social network (such as, for example, profile pages) bysearching for content connected to or otherwise related to theidentified user nodes 202 and the identified edges 206. As an exampleand not by way of limitation, in response to the text query, “show mefriends of my girlfriend,” the social-networking system 160 may generatea structured query “Friends of Stephanie,” where “Friends” and“Stephanie” in the structured query are references corresponding toparticular social-graph elements. The reference to “Stephanie” wouldcorrespond to a particular user node 202 (where the social-networkingsystem 160 has parsed the n-gram “my girlfriend” to correspond with auser node 202 for the user “Stephanie”), while the reference to“Friends” would correspond to friend-type edges 206 connecting that usernode 202 to other user nodes 202 (i.e., edges 206 connecting to“Stephanie's” first-degree friends). When executing this structuredquery, the social-networking system 160 may identify one or more usernodes 202 connected by friend-type edges 206 to the user node 202corresponding to “Stephanie”. As another example and not by way oflimitation, in response to the text query, “friends who work atfacebook,” the social-networking system 160 may generate a structuredquery “My friends who work at Facebook,” where “my friends,” “work at,”and “Facebook” in the structured query are references corresponding toparticular social-graph elements as described previously (i.e., afriend-type edge 206, a work-at-type edge 206, and concept node 204corresponding to the company “Facebook”). These structured queries maybe pre-generated and accessed from a cache or generated dynamically inresponse to input from the user. Although this disclosure describesgenerating particular structured queries in a particular manner, thisdisclosure contemplates generating any suitable structured queries inany suitable manner.

In particular embodiments, social-networking system 160 may score thegenerated structured queries. The score may be, for example, aconfidence score, a probability, a quality, a ranking, another suitabletype of score, or any combination thereof. The structured queries may bescored based on a variety of factors, such as, for example, the page ortype of page the user is accessing, user-engagement factors,business-intelligence data, the click-thru rate of particular queries,the conversion-rate of particular queries, user-preferences of thequerying user, the search history of the user, advertising sponsorshipof particular queries, the querying user's social-graph affinity forsocial-graph elements referenced in particular queries, the intent ofthe user, the general or current popularity of particular queries, theusefulness of particular queries, the geographic location of the user,other suitable factors, or any combination thereof. Although thisdisclosure describes ranking structured queries in a particular manner,this disclosure contemplates ranking structured queries in any suitablemanner.

In particular embodiments, social-networking system 160 may send one ormore of the structured queries to the querying user. As an example andnot by way of limitation, after the structured queries are generated,the social-networking system 160 may send one or more of the structuredqueries as a response (which may utilize AJAX or other suitabletechniques) to the user's client system 130 that may include, forexample, the names (name strings) of the referenced social-graphelements, other query limitations (e.g., Boolean operators, etc.), aswell as, potentially, other metadata associated with the referencedsocial-graph elements. The web browser 132 on the querying user's clientsystem 130 may display the sent structured queries in a drop-down menu300, as illustrated in FIGS. 4A-4B. In particular embodiments, the sentqueries may be presented to the querying user in a ranked order, suchas, for example, based on a rank previously determined as describedabove. Structured queries with better rankings may be presented in amore prominent position. Furthermore, in particular embodiments, onlystructured queries above a threshold rank may be sent or displayed tothe querying user. As an example and not by way of limitation, asillustrated in FIGS. 4A-4B, the structured queries may be presented tothe querying user in a drop-down menu 300 where higher ranked structuredqueries may be presented at the top of the menu, with lower rankedstructured queries presented in descending order down the menu. In theexamples illustrated in FIGS. 4A-4B, only the seven highest rankedqueries are sent and displayed to the user. In particular embodiments,one or more references in a structured query may be highlighted (e.g.,outlined, underlined, circled, bolded, italicized, colored, lighted,offset, in caps) in order to indicate its correspondence to a particularsocial-graph element. As an example and not by way of limitation, asillustrated in FIG. 4B, the references to “Stanford University” and“Stanford, Calif.” are highlighted (outlined) in the structured queriesto indicate that it corresponds to a particular concept node 204.Similarly, the references to “Friends”, “like”, “work at”, and “go to”in the structured queries presented in drop-down menu 300 could also behighlighted to indicate that they correspond to particular edges 206.Although this disclosure describes sending particular structured queriesin a particular manner, this disclosure contemplates sending anysuitable structured queries in any suitable manner.

In particular embodiments, social-networking system 160 may receive fromthe querying user a selection of one of the structured queries. Thenodes and edges referenced in the received structured query may bereferred to as the selected nodes and selected edges, respectively. Asan example and not by way of limitation, the web browser 132 on thequerying user's client system 130 may display the sent structuredqueries in a drop-down menu 300, as illustrated in FIGS. 4A-4B, whichthe user may then click on or otherwise select (e.g., by touching thequery on a touchscreen or keying “enter” on his keyboard) to indicatethe particular structured query the user wants the social-networkingsystem 160 to execute. Although this disclosure describes receivingselections of particular structured queries in a particular manner, thisdisclosure contemplates receiving selections of any suitable structuredqueries in any suitable manner.

More information on structured search queries and grammar models may befound in U.S. patent application Ser. No. 13/556,072, filed 23 Jul.2012, U.S. patent application Ser. No. 13/674,695, filed 12 Nov. 2012,and U.S. patent application Ser. No. 13/731,866, filed 31 Dec. 2012,each of which is incorporated by reference.

Generating Keywords and Keyword Queries

In particular embodiments, social-networking system 160 may providecustomized keyword completion suggestions (herein referred to simply as“keyword suggestions”) to a querying user as the user is inputting atext string into a query field. Keyword suggestions may be provided tothe user in a non-structured format. In order to generate a keywordsuggestion, the social-networking system 160 may access multiple sourceswithin the social-networking system 160 to generate keyword suggestions,score the suggestions from the multiple sources, and then return thekeyword suggestions to the user. As an example and not by way oflimitation, and as described further below, if a user types the query“friends stan,” then the social-networking system 160 may suggest, forexample, “friends stanford,” friends stanford university,” friendsstanley,” “friends stanley cooper,” “friends stanley kubrick,” “friendsstanley cup,” and “friends stanlonski.” In this example, thesocial-networking system 160 is suggesting the keywords which aremodifications of the ambiguous n-gram “stan”, where the suggestions maybe generated from a variety of keyword generators. The social-networkingsystem 160 may have selected the keyword suggestions because the user isconnected in some way to the suggestions. As an example and not by wayof limitation, the querying user may be connected within social graph200 to the concept node 204 corresponding to Stanford University, forexample by like- or attended-type edges 206. The querying user may alsohave a friend named Stanley Cooper. The querying user may have greaterthan one degree of separation from the social-graph entity associatedwith the suggested keyword(s). As an example and not by way oflimitation, the querying user may have friends that have a “like”connection to the director Stanley Kubrick (i.e., the friends correspondto user nodes 202 connected by a like-type edge 206 to the concept node204 corresponding to deceased director Stanley Kubrick). As anotherexample and not by way of limitation, the querying user may have friendsthat have posted about the “Stanley Cup” (i.e., the friends correspondto user nodes 202 connected by posted-type edges to concept nodes 204corresponding to posts that include content about the Stanley Cup, orinclude tags to the Stanly Cup). As yet another example and not by wayof limitation, the querying user may have a friend who is friends with aperson named Stanlonski (i.e., Stanlonski is a second-degree connectionof the querying user). As another example and not by way of limitation,if a user types “lady,” the social-networking system 160 may suggest“lady gaga,” and “lady bug.” In the example, the social-networkingsystem 160 is suggesting the keywords which are modifications of theambiguous n-gram “lady.” The keyword suggestions “lady gaga” and “ladybug” may have been generated by the typeahead function described above.Although this disclosure describes generating keyword suggestions in aparticular manner, this disclosure contemplates generating keywordsuggestions in any suitable manner.

In particular embodiments, social-networking system 160 may search aplurality of keyword generators to identify one or more keywordsuggestions matching the ambiguous n-gram. As discussed previously,social-networking system 160 may receive from a client system 130 of afirst/querying user an unstructured text query. As an example and not byway of limitation, social-networking system 160 may receive from aclient system 130 an unstructured text query such as “friends stan,” or“lady.” Furthermore, as discussed previously, social-networking system160 may parse the text query to identify one or more n-grams, wherein atleast one of the n-grams is an ambiguous n-gram. As noted above, if ann-gram is not immediately resolvable to a single social-graph elementbased on the parsing algorithm used by the social-networking system 160,it may be an ambiguous n-gram. The parsing may be performed as describedin detail hereinabove. As an example and not by way of limitation,social-networking system 160 may receive the text query “friend stan.”The text query may be parsed into the n-grams “friend” and the ambiguousn-gram “stan.” “stan” is an ambiguous n-gram because it does not match aspecific element of social graph 200. By contrast, “friends” refers to aspecific type of edge 206, “friend” and therefore may not be consideredambiguous. Social-networking system 160 may then search a plurality ofkeyword generators to identify one or more keyword suggestions to matchthe ambiguous n-gram “stan.” Each identified keyword suggestion maycorrespond to one or more second nodes of the plurality of second nodes.The suggested keywords may come from a variety of sources, for exampleand not by way of limitation, a query-log keyword generator, a typeaheadkeyword generator, a grammar-parser keyword generator, a metadatakeyword generator, another suitable source, or any combination thereof.Although this disclosure describes identifying keyword suggestions in aparticular manner, this disclosure contemplates identifying keywordsuggestions in any suitable manner.

In particular embodiments, social-networking system 160 may calculate akeyword score for each identified keyword suggestion. The keyword scoremay be calculated differently, depending on the source of the keywordsuggestion. In particular embodiments, calculating a keyword score foreach identified keyword suggestions may include applying a weighingfactor to each keyword based on the type of keyword suggestions. As usedherein, the type of keyword suggestion refers to the type of keywordgenerator that generated the keyword. In particular embodiments,calculating a keyword score for each identified keyword suggestion mayinclude blending the keyword suggestions from the plurality of keywordgenerators to form a set of blended keyword suggestions. As an exampleand not by way of limitation, keyword suggestions may be ranked based onthe source of the keyword suggestion, and then the keyword suggestionsmay be merged by a blending algorithm. The blending algorithm may, forexample, use an iterative blending process that pulls the from thetop-ranked keyword suggestions from each keyword generator. More onblending processes may be found in U.S. application Ser. No. 14/244,748,filed on 3 Apr. 2014, and U.S. application Ser. No. 14/454,826, filed on8 Aug. 2014, each of which is incorporated by reference. Although thisdisclosure describes calculating a keyword score in a particular manner,this disclosure contemplates calculating a keyword score in any suitablemanner.

In particular embodiments, the query-log keyword generator may include alist of queries previously entered. As an example and not by way oflimitation, the previously entered queries may include queriespreviously received from a plurality of client systems 130 (e.g., priorqueries entered by users of the online social network). The keywordscore of query-log keyword suggestions may be calculated based at leastin part on one or more of: (1) the number of times each query-logkeyword suggestion has been searched; (2) the number of times eachquery-log keyword suggestion was selected (e.g., clicked on, etc.); (3)the popularity of the one or more second nodes with which each query-logkeyword suggestion corresponds; (4) other suitable factors; or (5) anycombination thereof. As an example and not by way of limitation, if afirst user has previously entered the search queries “friends stanford,”“friends stanford university,” and “friends standard” the socialnetworking system 160 may provide the keyword suggestion “friendsstanford,” friends stanford university,” and “friends standard” inresponse to the first user inputting the text string “friends stan” intoquery field 350. If the querying user has entered the query “friendsstanford” several times and selected it several times, the keywordsuggestion “friends stanford” may receive a relatively higher keywordscore than other keyword suggestions. In contrast, the first user mayhave entered “friends standard” only once. In this example, the keywordsuggestion “friends standard” would therefore receive a relatively lowerkeyword score. The keyword suggestion “friends stanford university” maybe associated with concept node 204 corresponding to StanfordUniversity. If the concept node 204 associated with Stanford Universityis popular (e.g., the profile page associated with the concept node 204associated with Stanford University has been visited many times, or theconcept node 204 associated with Stanford University has received a lotof likes) the keyword suggestion “friends stanford university” mayreceive a relatively higher keyword score than other keywordsuggestions. Although this disclosure describes identifying particularquery-log keyword suggestions in a particular manner, this disclosurecontemplates identifying any suitable query-log keyword suggestions inany suitable manner.

In particular embodiments, the typeahead keyword generator may use thetypeahead features as described hereinabove. The typeahead keywordgenerator may identify one or more second nodes matching the ambiguousn-gram (e.g., the ambiguous n-gram matches to a character string (e.g.,names, descriptions) corresponding to particular users, concepts, oredges and their corresponding elements in the social graph 200). Thetypeahead keyword suggestion may be generated corresponding to eachsecond node matching the ambiguous n-gram. The keyword score oftypeahead keyword suggestions may be based at least in part on one ormore of: (1) the popularity of the one or more second nodes with whicheach typeahead keyword suggestion corresponds; (2) the number of timesthe typeahead keyword suggestion has been searched; (3) the number oftimes a page (e.g., a user-profile page, a concept-profile page, oranother suitable page) associated with the one or more second nodes withwhich each typeahead keyword suggestions corresponds has been visited;(4) other suitable factors; or (5) any combination thereof. As anexample and not by way of limitation, the social-networking system 160may generate the suggested queries with the keyword suggestions “friendsstanley cooper” and “friends stanley caruso” in response to the queryinguser entering the text string “friends stan” into query field 350. Asnoted above, “stan” may be considered an ambiguous n-gram. In thisexample, Stanley Cooper and Staley Caruso may correspond to user nodes202 having names that match the ambiguous n-gram “stan”. If the queryinguser has visited the profile page associated with the user StanleyCooper several times, and the profile page associated with StanleyCooper is popular (e.g., the profile page associated with Stanley Cooperhas been visited many times) the keyword suggestion “stanley cooper” mayreceive a relatively higher keyword score than other keywordsuggestions. In contrast, if the querying user has never been to theprofile page associated with the user Stanley Caruso, and has neversearched for Stanley Caruso, the keyword suggestions “stanley caruso”may receive a relatively lower keyword score. Although this disclosuredescribes identifying particular typeahead keyword suggestions in aparticular manner, this disclosure contemplates identifying any suitabletypeahead keyword suggestions in any suitable manner.

In particular embodiments, the grammar-parser keyword generator maygenerate keywords by processing the text query received from thequerying user with a grammar model. As an example and not by way oflimitation, social-networking system 160 may identify one or more edgescorresponding to one or more n-grams identified from the text query,access a context-free grammar model, identify one or more grammars, andgenerate one or more grammar-parser keyword suggestions based on querytokens from the identified grammars. The keyword score of grammar-parserkeyword suggestions may be based at least in part on one or more of: (1)the degree of separation between the first-user node and the identifiedsecond nodes corresponding to the query tokens of the identifiedgrammars; (2) edges corresponding to the query tokens of the grammar;(3) the number of identified edges connected to the identified secondnodes corresponding to the query tokens of the grammar; (4) the searchhistory associated with the first user; (5) other suitable factors; or(6) any combination thereof. As an example and not by way of limitation,in response to the querying user inputs the text query “friendsstanford”, social-networking system 160 may access a grammar model andparse the text query into natural-language string “My friends who wentto Stanford University,” where the various terms in the natural-languagestring correspond to query tokens of a particular grammar. Based onthese query tokens, social-networking system 160 may identifyingkeywords corresponding to the query tokens, such as “my,” “who,” “went,”“to,” and “university.” One or more of these identified keywordscorresponding to the query tokens may then be used as keywordsuggestions in one or more suggested queries. As an example and not byway of limitation, one of the suggested queries generated in response tothe text query “friends stanford” may be “friends stanford university,”or possibly “friends who went to stanford university” (note that in thiscase, the suggested query modifies the original text query input byinserting keyword suggestions in the middle and at the end of thequery). Note that unlike the output of the grammar model, the suggestedquery is not a natural-language sting and is not necessarilygrammatically correct. In particular embodiments, the plurality ofgrammars may be a grammar forest organized as an ordered tree comprisinga plurality of non-terminal tokens and a plurality of query tokens, eachgrammar being an ordered sub-tree adjoining one or more other grammarsvia a non-terminal token. The social-networking system 160 may determinewhich sub-branches of the branched entity might be a good match andcombine them with the grammar rules. The social-networking system 160may also filter out bad grammar suggestions and render them in adifferent way. As an example and not by way of limitation, if a usertypes a query “friends allan stanford,” the social-networking system 160may determine and retrieve all terms for “stanford” and determine, basedon the scores associated with each term, whether they are a good match.The social-networking system 160 may determine that query tokenscorresponding to the school “Stanford University” are not a good match,while query tokens corresponding to the user “Allan Stanford” are a goodmatch based on the final score from the data source, and then identifyother query tokens from grammars containing the “Allan Stanford” querytoken for use as keyword suggestions. More on grammar models may befound in U.S. application Ser. No. 13/674,695, filed on 12 Nov. 2012,and U.S. application Ser. No. 13/731,866, filed on 31 Dec. 2012, each ofwhich is incorporated by reference. Although this disclosure describesidentifying particular grammar-parser keyword suggestions in aparticular manner, this disclosure contemplates identifying any suitablegrammar-parser keyword suggestions in any suitable manner.

In particular embodiments, the metadata keyword generator may identifykeywords by identifying social-graph information associated with thequerying user and corresponding to one or more n-grams identified fromthe text query, and generate one or more metadata keyword suggestionsbased on the identified social-graph information. In particularembodiments, the social-graph information may include, for example,information about connections of matching social-graph entities to otherentities (e.g., friends, check-in, work-at, live-in, etc.). As anexample and not by way of limitation, if there is a user John Smith whoworks at Facebook, in response to the query “john smith,” thesocial-networking system 160 may generated the suggested query “johnsmith facebook,” where the keyword suggestion “facebook” is providedbased on the connection between the user John Smith and Facebook in thesocial graph 200. In particular embodiments, the metadata may includelocation data associated with the users of the online social network.More on location data can be found in U.S. application Ser. No.14/323,940, filed on 3 Jul. 2014, which is incorporated by reference. Asan example and not by way of limitation, if the user is currently in thecity of Palo Alto, in response to the query “restaurant,” thesocial-networking system 160 may generate the keyword suggestion“restaurant palo alto,” where the keyword suggestion “palo alto” isprovided based on the currently location data associated with thequerying user. Although this disclosure describes identifying particularmetadata keyword suggestions in a particular manner, this disclosurecontemplates identifying any suitable metadata keyword suggestions inany suitable manner.

FIG. 5 illustrates example keyword suggestions of the online socialnetwork. In particular embodiments, social-networking system 160 maygenerate one or more suggested queries based on the identified keywordsuggestions. Each suggested query may include one or more n-gramsidentified from the text query and one or more identified keywordsuggestions having a keyword score greater than a threshold keywordscore. For example, FIG. 5 illustrates the suggested queries “friendsstanford,” “friends stanford university,” “friends stanley,” “friendsstanley cooper,” “friends stanley kubrick,” “friends stanley cup,” and“friends stanlonski”, which are displayed in drop-down menu 300. Thesuggested queries include keyword suggestions that have been generatedbased on the unstructured query “friends stan,” which has been inputtedby a querying user in query field 350. In this example, the n-gram“stan” may be identified as an ambiguous n-gram because it may refer tomultiple social-graph entities, such as, for example, the concept node204 corresponding to the school Stanford University, the concept node204 corresponding to the city of Stanford, Calif., or one or more usernodes 202 for users with the name “Stanford.” The keyword suggestion“stanford university” is provided as part of a suggested query becausethe n-gram “stan” matches the name of the concept node 204 correspondingto Stanford University. In the example shown in FIG. 5, the queryinguser may have previously searched for “friends stanford” several times.Therefore, the keyword suggestion “stanford,” generated by the query-logkeyword generator may have a high keyword score. The user may have ahigh affinity for Stanford University, for example, because the user isconnected to Stanford University by a like-type edge 206 and/or anattended-type edge 206. Therefore the suggested query “friends stanforduniversity,” generated, for example, by the grammar-parser keywordgenerator, may also receive a relatively high keyword score, and may bepresented high on the list of suggested queries. The suggested query“friends stanley cooper,” generated, for example, by the typeaheadkeyword generator, may correspond to a user node 202, to which thequerying user has a “friend” connection, therefore, the suggested query“friends stanley cooper” also received a relatively high keyword score.The suggested queries “friends stanley kubrick” and “friends stanleycup” are references to particular concept nodes 204 of the social graph200 corresponding to the director Stanley Kubrick and the event StanleyCup, respectively. Similarly, the keyword suggestion “stanlonski” maycorrespond to a user node 202 for a user named “Stanlonski”, to whichthe querying user may be connected. In the example illustrated in FIG.5, the three keyword suggestions “stanley kubrick,” “stanley cup,” and“stanlonski” may correspond to social-graph entities having a lowaffinity for the querying user (e.g., the entities are two or moredegrees of separation from the querying user) and thus may receiverelatively low keyword scores and be ranked lower than suggested queriescomprising other keyword suggestions. In the example described herein,the keyword suggestions come from a plurality of sources and are blendedtogether to provide one list of suggested queries, shown in drop-downmenu 300. The keyword suggestions are provided as examples, and are notintended as limitations. The keyword suggestions used in the suggestedqueries may include keywords associated with any user node 202 orconcept node 204 (e.g. the name of the user or concept) that may beinteresting to the user. The suggested queries in drop-down menu 300illustrate a progression from simpler keyword suggestions (e.g., “friendstanford”) to more complex keyword suggestions (e.g., “friend stanforduniversity”). This method of sorting is provided as an example, and isnot intended as a limitation. Finally, the text in the suggested queriesis bolded to illustrate how the keyword suggestions are modifying theambiguous n-gram “stan.” Although this disclosure describes and FIG. 5illustrated generating particular suggested queries with particularkeyword suggestions in a particular manner, this disclosure contemplatesany suitable suggested queries with any suitable keyword suggestions inany suitable manner.

In particular embodiments, social-networking system 160 may filter orotherwise remove keyword suggestions from the set of identified keywordsuggestions. Keyword suggestions may be filtered/removed in a variety ofways. In particular embodiments, the social-networking system 160 mayfilter out keyword suggestions that would result in a null-search fromthe identified keyword suggestions. Social-networking system 160 maycheck the search results that would be generated in response toselecting a suggested query with a particular keyword suggestion to makesure the keyword suggestion provided will actually generate one or moresearch results. In particular embodiments, the social-networking system160 may determine whether the identified keyword suggestions result in anull-search. A null-search, as used herein, refers to a search querythat produces zero search results. A null-search may result, forexample, if a keyword suggestion is relatively long or detailed. As anexample and not by way of limitation, the search string “friendsstanford vanderbilt colgate boston” may result in a null-search becauseno content objects associated with the online social network match allof the terms of the search query. In particular embodiments, thesocial-networking system 160 may remove one or more keyword suggestionsresulting in a null-search from the identified keyword suggestions,thereby preventing those keyword suggestions from be incorporated intosuggested queries presented to the querying user. The social-networkingsystem 160 may also run privacy checks to make sure that keywordsuggestions are not presented to a user that would rely on non-visibleinformation. More on filtering suggested queries based on privacysettings can be found in U.S. application Ser. No. 13/556,017, filed on23 Jul. 2012, which is incorporated by reference. Although thisdisclosure describes filtering keyword suggestions in a particularmanner, this disclosure contemplates filtering keyword suggestions inany suitable manner.

In particular embodiments, the social-networking system 160 may send oneor more of the suggested queries to the client system 130 of the userfor display. The suggested queries (e.g., suggested structured queries,or suggested queries comprising keyword suggestions) may be sent bysocial-networking system 160 responsive to receiving the unstructuredtext query. The suggested queries may be displayed in ranked order basedon the keyword score of the identified keyword suggestions included ineach suggested query. As an example and not by way of limitation, if thesuggested query “friends stanford” has a higher keyword score than thesuggested query “friends stanford university,” the suggested queries maybe displayed with “friends stanford” displayed first and “friendsstanford university” displayed second. In particular embodiments, thesuggested queries may be displayed on a user interface of a nativeapplication associated with the online social network on the clientsystem of the first user. As an example and not by way of limitation,the native application may be an application associated with thesocial-networking system on a user's mobile client system (e.g. a smartphone, tablet, etc.). In particular embodiments, the suggested queriesmay be displayed on a webpage of the online social network accessed by abrowser client 132 on the client system 130 of the first user. Althoughthis disclosure describes sending the suggested queries in a particularmanner, this disclosure contemplates sending the suggested queries inany suitable manner.

FIG. 6 illustrates an example method 600 for providing keywordsuggestions. The method may begin at step 610, where social-networkingsystem 160 may access a social graph 200 comprising a plurality of nodesand a plurality of edges 206 connecting the nodes. The nodes maycomprise a first user node 202 and a plurality of second nodes (one ormore user nodes 202, concept nodes 204, or any combination thereof). Atstep 620, social-networking system 160 may receive from a client systemof a first user an unstructured query. At step 630, social-networkingsystem 160 may parse the text query to identify one or more n-grams. Atstep 640, social-networking system 160 may search a plurality of keywordgenerators to identify one or more keyword suggestions matching theambiguous n-gram. At step 650, social-networking system 160 maycalculate a keyword score for each identified keyword suggestion. Atstep 660, social-networking system 160 may generate one or moresuggested queries. Each suggested query may comprise one or more n-gramsidentified from the text query. One or more keyword suggestions may havea keyword score greater than a threshold keyword score. At step 670, thesocial-networking system 160 may send one or more of the suggestedqueries to the client system of the first user for display. Step 670 maybe responsive to receiving the unstructured text query. The suggestedqueries may be displayed in ranking order based on the keyword scores ofthe identified keyword suggestions comprising each query. Particularembodiments may repeat one or more steps of the method of FIG. 6, whereappropriate. Although this disclosure describes and illustratesparticular steps of the method of FIG. 6 as occurring in a particularorder, this disclosure contemplates any suitable steps of the method ofFIG. 6 occurring in any suitable order. Moreover, although thisdisclosure describes and illustrates an example method for providingkeyword suggestions including the particular steps of the method of FIG.6, this disclosure contemplates any suitable method for providingkeyword suggestions including any suitable steps, which may include all,some, or none of the steps of the method of FIG. 6, where appropriate.Furthermore, although this disclosure describes and illustratesparticular components, devices, or systems carrying out particular stepsof the method of FIG. 6, this disclosure contemplates any suitablecombination of any suitable components, devices, or systems carrying outany suitable steps of the method of FIG. 6.

Determining Query Intent and Generating Search Results

In particular embodiments, social-networking system 160 may determinethe intent of a search query (herein referred to simply as “searchintent(s),” or “intent(s)”) and provide a customized search experiencebased on the search intent. The social-networking system 160 maydetermine the search intent based on entity and topic matching, and thenprovide search results to the user based on the determined searchintent. As an example and not by way of limitation, if a querying useris performing a people search (e.g., a search for users of the onlinesocial network the querying user may know in real life) as opposed to acelebrity search or a pages search (e.g., a search for content on theonline social network associated with a particular celebrity or otherentity), the user experience may be improved by determining the intentof the query in order to determine what will be displayed to thequerying user. If there is a single best result for the query (e.g., anentity match corresponding to a typeahead selection), thesocial-networking system 160 may list the single best result query.However, if the query is ambiguous or would generate multiple results(e.g., structured queries or keyword queries), the social-networkingsystem 160 may return a list of options for the user. As another exampleand not by way of limitation, if the user inputs the query “friendsalex,” the social-networking system 160 may determine this is a peoplesearch and return blended search results that have been customized basedon the user's intent to search for people. For example, these blendedresults may include a plurality of search-result modules, wherein eachsearch-results module The search-result modules may includesearch-result modules that relate to particular structured queriesgenerated by parsing the original query “alex.” For example, thesocial-networking system 160 may generate the structured queries“Friends of Alex Binder”, “Friends of Alex Smith” (where the referencesto “Alex Binder” and “Alex Smith” correspond to a particular user nodes202 for those users), “My friends who live in Alexandria, Egypt” (wherethe reference to “Alexandria, Egypt” corresponds to a particular conceptnode 204 for that location), and “Friends named ‘Alex’”. Eachsearch-result module may also comprise one or more search resultscorresponding to users of the online social network that match thestructured query corresponding to that search-result module. The moduleblending may use functionality described herein. More on search intentcan be found in U.S. application Ser. No. 13/887,015, filed on 3 May2013, which is incorporated by reference. Although this disclosuredescribes generating search results based on search intents in aparticular manner, this disclosure contemplates generating searchresults based on search intents in any suitable manner.

In particular embodiments, the social-networking system 160 maydetermine one or more search intents of a search query received from auser of the online social network. As discussed previously,social-networking system 160 may receive a search query from a clientsystem 130 of a querying user. Furthermore, as discussed previously,social-networking system 160 may identify one or more nodes that matchthe search query. Determining intent may be based on a variety factors,including topics associated with the identified nodes, the node-types ofthe identified nodes matching the query, other suitable factors, or anycombination thereof. Although this disclosure describes determiningsearch intents in a particular manner, this disclosure contemplatesdetermining search intents in any suitable manner.

In particular embodiments, social-networking system 160 may determineone or more search intents of a search query based in part on one ormore node-types of the nodes identified as matching the search query. Asan example and not by way of limitation, social-networking system 160may receive the search query “lady gaga.” The social-networking system160 may identify a profile page associated with the celebrity Lady Gagaas being the best matching object for the search query. Thesocial-networking system 160 may then determine that the intent of thesearch was a celebrity search, based on the identified node beingassociated with a celebrity. As another example and not by way oflimitation, social-networking system 160 may receive the search query“london.” The social-networking system 160 may identify a profile pageassociated with the city London, United Kingdom and a profile pageassociated with the city London, Ontario. The social-networking system160 may then determine that the intent of the search was a locationsearch (e.g., a search for content on the online social networkassociated with a particular location) based on the node-types of theidentified nodes, which in this example are both associated withparticular cities. In particular embodiments, the search query may be anunstructured text query. When the search query is an unstructured textquery, the social-networking system 160 may identify one or more secondnodes matching the ambiguous n-gram (as described previously). As anexample and not by way of limitation, if the search query is “alex,” thesocial-networking system may identify a plurality of user nodes 202, forexample “Alex Smith” or “Alex Cooper,” which match the ambiguous n-gram“alex.” The social-networking system 160 may determine that the intentof the search was a people search, because the search results include anumber of people-type nodes. Although this disclosure describesdetermining search intents based on node-types in a particular manner,this disclosure contemplates determining search intents based onnode-types in any suitable manner.

In particular embodiments, the social-networking system 160 may search aplurality of verticals 164 (i.e., data stores) to identify a pluralityof sets of objects in each vertical 164, respectively, that match thesearch query. Each vertical 164 may store one or more objects associatedwith the online social network, and each object may correspond to a usernode 202 or concept node 204. In particular embodiments, determiningintent may be based on the object-type associated with each verticalhaving at least one object that matches the search query. In particularembodiments, the social-networking system 160 may blend the plurality ofsets of identified objects from each vertical to form a set of blendedsearch results including a threshold number of identified objects. Eachvertical may store objects of a particular object-type, for example auser, a photo, a post, a page, an application, an event, a location, ora user group. The social-networking system 160 may perform a regularentity search, review the distribution of object-types that is obtainedfrom the search, and use that as a factor in determining the queryintent. As an example and not by way of limitation, if the querying userenters the query “alex,” many users (corresponding each to particularuser nodes 202) may be identified in a users vertical 164 by thesocial-networking system 160, and the social-networking system 160 maydetermine that the search is likely a people search. In contrast, if thequerying user enters the query “soccer,” many posts related to the topicsoccer (e.g. user posts about soccer, or the World Cup) may beidentified by the social-networking system 160, and thesocial-networking system 160 may determine that the search is likely atopic search (e.g., a search for content on the online social networkassociated with a particular topic). Where a variety of entity types arepulled, the social-networking system 160 may use the distribution of theentities, the scores/ranks determined by the verticals 164 (each ofwhich may have its own scoring/ranking algorithm used when retrievingresults in response to a search query), and social-graph information, todetermine what is the most common or the most likely type of entity thethat the query is referring to. As an example and not by way oflimitation, if a querying user enters the query “London,” many objectsrelated to the city London, United Kingdom may be identified (e.g., aprofile page associated with the city, photos or posts tagging the city,users who live in the city, etc.). Additionally, user nodes 202associated with users having the first or last name “London” may also beidentified. In this scenario, the social-networking system 160 may usethe distribution of entities, for example, the fact that there are moreentities associated with the city London, United Kingdom than usersnodes 202 associated with users having the last name London, anddetermine that the search is likely a location search. Similarly, thesocial-networking system 160 may use social-graph information asdescribed herein above to determine that the search is likely a locationsearch. As an example and not by way of limitation, if a querying userenters the query “London,” and the social-networking system 160determines that the user is located near the city of London, UnitedKingdom, the social-networking system 160 may determine that the searchis likely a location search. Although this disclosure describesdetermining search intents based on object-types in a particular manner,this disclosure contemplates determining search intents based onobject-types in any suitable manner.

In particular embodiments, the social-networking system 160 may performa topic tagger search, in which the social-networking system 160 matchesthe query to a defined set of topics (e.g., a dictionary orencyclopedia), referred to herein as an electronic topic index. Inparticular embodiments, the social-networking system 160 may identify atleast one candidate node corresponding to the query, wherein eachcandidate node corresponds to an electronic topic index. Matching thesearch query may include, in no particular order, (1) receiving anelectronic topic index comprising a set of nodes, wherein each noderepresents a topic; (2) identifying an anchor term in the query; (3)identifying candidate nodes based on the anchor term, wherein candidatenodes comprise electronic-topic-index nodes representing subjectsrelated to the anchor term; (4) determining a context of the anchor termin the query; (5) determining a score for each of the one or more of thecandidate nodes based on the determined context; and (6) determiningwhether there is a candidate node to represent the meaning of the anchorterm based on the determined scores. In particular embodiments,receiving an electronic topic index may include retrieving a database ofarticles, wherein one or more pairs of articles are linked, creating anode for each of the one or more articles, the node comprising the topicof the article, and for each pair of nodes corresponding to linkedarticles, connecting the pair of nodes with an edge. The database ofarticles may include a web-based database, wherein each article isrepresented by a web page within the web-based database, and wherein twoarticles are linked if the web page representing one of the articlescontains a URL link to the other article. The determined intent may bebased on the electronic-topic-index nodes associated with the candidatenodes that represent the meaning of the anchor term. As an example andnot by way of limitation, if the search query is “lady gaga,” thesocial-networking system 160 may identify the anchor node “lady gaga”and identify the candidate node associated with theelectronic-topic-index node associated with the celebrity lady gaga. Thesocial-networking system 160 may then determine that the intent is acelebrity search based on the electronic-topic-index node associatedwith lady gaga. As another example and not by way of limitation, if thesearch query is “london,” and the electronic-topic-index node associatedwith the city of London, United Kingdom is identified as matching thesearch query, the social-networking system 160 may determine that thesearch is a location search. More on using an electronic topic index,and further, inferring topics from the electronic topic indexes withwhich the nodes are associated can be found in U.S. application Ser. No.13/167,701, filed on 24 Jun. 2011, which is incorporated by reference.

In particular embodiments, the social-networking system 160 may obtainresults from a plurality of searches, for example an entity search andtopic tagger, and may review both results together. If thesocial-networking system 160 determines that there is a match betweenthe results from the topic tagger and the entity search, then thosematches provide strong signals that define the intent of the query. Forexample, if the topic tagger identifies the electronic-topic-indexassociated with Lady Gaga, and the entity search identifies the profilepage associated with Lady Gaga, there is a strong indication that thesearch intent is a celebrity search. However, if the social-networkingsystem 160 determines that there is no topic match, then distributionmay be used with the entity results in combination with text estimation.As used herein, text estimation is a language-model based textestimation of the classification for the query based on named entitieswithin the social graph and not necessarily based on the query the userenters. The social-networking system 160 may combine the query with thetext estimation and determine the query intent. As an example and not byway of limitation, this may be used for user detection because userqueries are a common query intent. The social-networking system 160 mayuse text estimation and entity search results to determine the queryintent. As an example and not by way of limitation, for the query“alex,” the social-networking system 160 may run an entity search and atopic tagger search. The entity search will likely return a large listof people with the first name Alex. The topic tagger may identify anelectronic-topic-index nodes associated with a celebrity, for exampleAlex Trebek, Alex Rodriguez, and Alexi Lalas. The text estimation sourcemay provide the social-networking system 160 a level of confidence thatthe name is a user name as opposed to a concept (e.g., a page,celebrity, or location) in the social graph. The social-networkingsystem 160 may determine whether there is a specific user being referredto unambiguously. In this example there is not. As such, a list of usersmatching the query for “alex” may be returned (or a plurality ofsearch-result modules corresponding to structured queries parsed from“alex” could be returned). The topic tagger may also be used todifferentiate possible entity matches from topic matches. As an exampleand not by way of limitation, the for the search query “JessicaSimpson,” the topic tagger may identify a likely topic (e.g., celebrityJessica Simpson) rather than a user search (e.g., random, non-celebrityusers named Jessica Simpson). Similarly, an entity search would indicatethat the search query “Jessica Simpson” is a celebrity query because theentity data associated with Jessica Simpson will indicate she is acelebrity. Although this disclosure describes determining intent in aparticular manner, this disclosure contemplates determining intent inany suitable manner.

In particular embodiments, intent may be determined based on whether thequery input is a strong or weak match to a grammar. Thesocial-networking system 160 will typically only use intent to blendsearch results when there is a weaker match to a grammar. When thesocial-networking system 160 has a high confidence that the querymatches a particular grammar of a grammar model, it will not blendresults with different search-result modules and instead will returnsearch results corresponding to the structured query generated based onthe grammar model. This may be because users who specifically inputstructured queries have essentially already explicitly inputted theirquery intent by inputting the structured query, which are typically morespecific and detailed than other types of queries, such as keywordqueries. As an example and not by way of limitation, if the first usertypes “friends who live in palo alto,” this may closely match aparticular grammar of a grammar model (e.g., being parsed by the grammarto generate the natural-language string “My friends who live in PaloAlto, Calif.”), and thus would be considered a strong match to agrammar. In this case, social-networking system 160 may instead generatea structured query and identify the particular objects corresponding tothe structured query. In contrast, the search query “board games” is anexample of a weak match to a grammar, since this may not closely matchany particular grammar when parsed in a grammar model. In other words,because a specific structured query cannot be adequately determined bythe social-networking system 160, it may instead determine the intent ofthe query as discussed previous, such as by doing an entity search andkeyword search. The query having a weak match to a grammar may thereforreturn blended modules based on the determined intent. More on grammarmodels may be found in U.S. application Ser. No. 13/674,695, filed on 12Nov. 2012, and U.S. application Ser. No. 13/731,866, filed on 31 Dec.2012, each of which is incorporated by reference. Although thisdisclosure describes determining search intents based on matchinggrammars in a particular manner, this disclosure contemplatesdetermining search intents based on matching grammars in any suitablemanner

FIGS. 7A-7D illustrate example views of search-results pages. Inparticular embodiments, social-networking system 160 may generate one ormore search results corresponding to a search query. The search resultsmay be generated based on the determined search intent. Each searchresult may include a reference to one of the identified nodes of socialgraph 200. The search-results page may include a plurality ofsearch-result modules, each search-result module being associated with aparticular object type, for example a user, a photo, a post, a page, anapplication, an event, a location, or a user group. In FIGS. 7A-7D, thesearch query is the term “Lady gaga.” The social-networking system 160has determined that the intent of the searcher was a celebrity searchbased on an entity search, a topic tagger search, or a combinationthereof. Specifically, the user was performing a search with the intentof receiving results related to the singer Lady Gaga. The resultsprovided in FIGS. 7A-7D are optimized based on the search intent. As anexample and not by way of limitation, FIG. 7A shows a search-resultspage corresponding to selection of the “Top” tab that provides ablending of search-result types based on the determined celebrity-typesearch intent. The blending may be performed as described hereinabove.The top hit is a link to the profile page associated with the conceptnode 204 associated with Lady Gaga. The second hit provides a link tobasic information about the performer Lady Gaga. The third hit providesthe grammar search “My friends who like Lady Gaga.” The user may alsodecide to view the search-results of a specific object-type. Theobject-types may be users, photos, posts, pages, applications, events,locations or user groups. Here, the different search-result modules areblended in this particular order based on the query having beenidentified as a celebrity search. As such, the best result correspondingto the search, corresponding to the node for Lady Gage, is presented asthe first search-result module. The second and third modules areprovided as being of particular interest to users doing celebritysearches. FIG. 7B shows the search-results page for people-type searchresults corresponding to the selection of the “People” tab. The firsthit is a user node 202 Lady Gaga. The following hits are user nodes 202that are connected to Lady Gaga by an edge 206. For example, the secondand third hits are connected to Lady Gaga by a “works-at” edge. FIG. 7Cshows a search-results page for photo-type search results correspondingto selection of the “Photos” tab. The photos shown in FIG. 7C relateLady Gaga. FIG. 7D shows a search-results page for page-type searchresults corresponding to selection of the “Pages” tab. The top searchresult is the page associated with the concept node 204 for Lady Gaga.The remaining hits are pages associated with additional concepts thatare related to Lady Gaga. Note that while the search results illustratedin FIGS. 7B-7D are of individual object types (i.e., people, photos, andpages, respectively), they may also be blended based on a determinedquery intent, as described previously. Although this disclosuredescribes and FIGS. 7A-7D illustrate generating particular searchresults in a particular manner, this disclosure contemplates generatingany suitable search results in any suitable manner.

FIGS. 8A-8D illustrate additional example views of search-results pages.In FIGS. 8A-8D, the search query is “London.” The social-networkingsystem 160 may have determined that the intent of the searcher was alocation search. This may have been determined because the searchresults returned few user pages, but a large number of location results.Additionally or alternatively, the topic tagger may have identified anelectronic-topic-index node associated with London, United Kingdom. FIG.8A shows a search-results page corresponding to selection of the “Top”tab that provides a blending of search-result types. The top hit is theprofile page associated with the concept node 204 London, UnitedKingdom. The second hit is a grammar search “My friends who like London,United Kingdom.” The third hit (only partially displayed) is a post bythe celebrity Jon Favreau, where the post tags the city of London (i.e.the concept node 204 corresponding to the post is connected by atagged-in type edge 206 to the concept node 204 corresponding toLondon). Here, the different search-result modules are blended in thisparticular order based on the query having been identified as a locationsearch. As such, the best result corresponding to the search,corresponding to the concept node 204 for London, is presented as thefirst search-result module. The second and third modules are provided asbeing of particular interest to users doing location searches. Not allhits must be related to a location. As an example and not by way oflimitation, FIG. 8B shows the search-results page for people-type searchresults corresponding to selection of the “People” tab. The first threeresults have the last name “London.” The fourth hit, may be connected tothe concept node 204 London, United Kingdom, by an edge 206, for examplea “lives-in” edge. FIG. 8C shows the search-results page for photo-typesearch results corresponding to selection of the “Photos” tab. Thephotos shown in FIG. 8C relate the places associated with the term“London.” FIG. 8D shows the search-results page for page-type searchresults corresponding to selection of the “Pages” tab. The top searchresult is the profile page associated with the concept node 204 London,United Kingdom. The second hit is associated with the concept node 204London, Ontario. Although this disclosure describes and FIGS. 8A-8Dillustrate generating particular search results in a particular manner,this disclosure contemplates generating any suitable search results inany suitable manner.

FIG. 9 illustrates an example method 900 for determining query intent.The method may begin at step 910, where social-networking system 160 mayaccess a social graph 200 comprising a plurality of nodes and aplurality of edges 206 connecting the nodes. The nodes may comprise afirst user node 202 and a plurality of second nodes (one or more usernodes 202, concept nodes 204, or any combination thereof). At step 920,social-networking system 160 may receive from a client system of thefirst user a search query. At step 930, social-networking system 160 mayidentify one or more second nodes that match the search query. At step940, social-networking system 160 may determine one or more searchintents of the search query. The determined intent may be based on oneor more topics associated with the identified nodes and one or morenode-types of the identified nodes. At step 950, social-networkingsystem 160 may generate one or more search results corresponding to thesearch query. The search results may be generated based on thedetermined search intents of the search query. Each search result mayinclude a reference to one of the identified second nodes. At step 960,the social-networking system 160 may send a search-results page to theclient system of the first user for display. Sending the search-resultspage may be responsive to receiving the search query. The search-resultspage may include one or more of the generated search results. Particularembodiments may repeat one or more steps of the method of FIG. 9, whereappropriate. Although this disclosure describes and illustratesparticular steps of the method of FIG. 9 as occurring in a particularorder, this disclosure contemplates any suitable steps of the method ofFIG. 9 occurring in any suitable order. Moreover, although thisdisclosure describes and illustrates an example method for determiningquery intent including the particular steps of the method of FIG. 9,this disclosure contemplates any suitable method for determining queryintent including any suitable steps, which may include all, some, ornone of the steps of the method of FIG. 9, where appropriate.Furthermore, although this disclosure describes and illustratesparticular components, devices, or systems carrying out particular stepsof the method of FIG. 9, this disclosure contemplates any suitablecombination of any suitable components, devices, or systems carrying outany suitable steps of the method of FIG. 9.

Social Graph Affinity and Coefficient

In particular embodiments, social-networking system 160 may determinethe social-graph affinity (which may be referred to herein as“affinity”) of various social-graph entities for each other. Affinitymay represent the strength of a relationship or level of interestbetween particular objects associated with the online social network,such as users, concepts, content, actions, advertisements, other objectsassociated with the online social network, or any suitable combinationthereof. Affinity may also be determined with respect to objectsassociated with third-party systems 170 or other suitable systems. Anoverall affinity for a social-graph entity for each user, subjectmatter, or type of content may be established. The overall affinity maychange based on continued monitoring of the actions or relationshipsassociated with the social-graph entity. Although this disclosuredescribes determining particular affinities in a particular manner, thisdisclosure contemplates determining any suitable affinities in anysuitable manner.

In particular embodiments, social-networking system 160 may measure orquantify social-graph affinity using an affinity coefficient (which maybe referred to herein as “coefficient”). The coefficient may representor quantify the strength of a relationship between particular objectsassociated with the online social network. The coefficient may alsorepresent a probability or function that measures a predictedprobability that a user will perform a particular action based on theuser's interest in the action. In this way, a user's future actions maybe predicted based on the user's prior actions, where the coefficientmay be calculated at least in part a the history of the user's actions.Coefficients may be used to predict any number of actions, which may bewithin or outside of the online social network. As an example and not byway of limitation, these actions may include various types ofcommunications, such as sending messages, posting content, or commentingon content; various types of observation actions, such as accessing orviewing profile pages, media, or other suitable content; various typesof coincidence information about two or more social-graph entities, suchas being in the same group, tagged in the same photograph, checked-in atthe same location, or attending the same event; or other suitableactions. Although this disclosure describes measuring affinity in aparticular manner, this disclosure contemplates measuring affinity inany suitable manner.

In particular embodiments, social-networking system 160 may use avariety of factors to calculate a coefficient. These factors mayinclude, for example, user actions, types of relationships betweenobjects, location information, other suitable factors, or anycombination thereof. In particular embodiments, different factors may beweighted differently when calculating the coefficient. The weights foreach factor may be static or the weights may change according to, forexample, the user, the type of relationship, the type of action, theuser's location, and so forth. Ratings for the factors may be combinedaccording to their weights to determine an overall coefficient for theuser. As an example and not by way of limitation, particular useractions may be assigned both a rating and a weight while a relationshipassociated with the particular user action is assigned a rating and acorrelating weight (e.g., so the weights total 100%). To calculate thecoefficient of a user towards a particular object, the rating assignedto the user's actions may comprise, for example, 60% of the overallcoefficient, while the relationship between the user and the object maycomprise 40% of the overall coefficient. In particular embodiments, thesocial-networking system 160 may consider a variety of variables whendetermining weights for various factors used to calculate a coefficient,such as, for example, the time since information was accessed, decayfactors, frequency of access, relationship to information orrelationship to the object about which information was accessed,relationship to social-graph entities connected to the object, short- orlong-term averages of user actions, user feedback, other suitablevariables, or any combination thereof. As an example and not by way oflimitation, a coefficient may include a decay factor that causes thestrength of the signal provided by particular actions to decay withtime, such that more recent actions are more relevant when calculatingthe coefficient. The ratings and weights may be continuously updatedbased on continued tracking of the actions upon which the coefficient isbased. Any type of process or algorithm may be employed for assigning,combining, averaging, and so forth the ratings for each factor and theweights assigned to the factors. In particular embodiments,social-networking system 160 may determine coefficients usingmachine-learning algorithms trained on historical actions and past userresponses, or data farmed from users by exposing them to various optionsand measuring responses. Although this disclosure describes calculatingcoefficients in a particular manner, this disclosure contemplatescalculating coefficients in any suitable manner.

In particular embodiments, social-networking system 160 may calculate acoefficient based on a user's actions. Social-networking system 160 maymonitor such actions on the online social network, on a third-partysystem 170, on other suitable systems, or any combination thereof. Anysuitable type of user actions may be tracked or monitored. Typical useractions include viewing profile pages, creating or posting content,interacting with content, tagging or being tagged in images, joininggroups, listing and confirming attendance at events, checking-in atlocations, liking particular pages, creating pages, and performing othertasks that facilitate social action. In particular embodiments,social-networking system 160 may calculate a coefficient based on theuser's actions with particular types of content. The content may beassociated with the online social network, a third-party system 170, oranother suitable system. The content may include users, profile pages,posts, news stories, headlines, instant messages, chat roomconversations, emails, advertisements, pictures, video, music, othersuitable objects, or any combination thereof. Social-networking system160 may analyze a user's actions to determine whether one or more of theactions indicate an affinity for subject matter, content, other users,and so forth. As an example and not by way of limitation, if a user maymake frequently posts content related to “coffee” or variants thereof,social-networking system 160 may determine the user has a highcoefficient with respect to the concept “coffee”. Particular actions ortypes of actions may be assigned a higher weight and/or rating thanother actions, which may affect the overall calculated coefficient. Asan example and not by way of limitation, if a first user emails a seconduser, the weight or the rating for the action may be higher than if thefirst user simply views the user-profile page for the second user.

In particular embodiments, social-networking system 160 may calculate acoefficient based on the type of relationship between particularobjects. Referencing the social graph 200, social-networking system 160may analyze the number and/or type of edges 206 connecting particularuser nodes 202 and concept nodes 204 when calculating a coefficient. Asan example and not by way of limitation, user nodes 202 that areconnected by a spouse-type edge (representing that the two users aremarried) may be assigned a higher coefficient than a user nodes 202 thatare connected by a friend-type edge. In other words, depending upon theweights assigned to the actions and relationships for the particularuser, the overall affinity may be determined to be higher for contentabout the user's spouse than for content about the user's friend. Inparticular embodiments, the relationships a user has with another objectmay affect the weights and/or the ratings of the user's actions withrespect to calculating the coefficient for that object. As an exampleand not by way of limitation, if a user is tagged in first photo, butmerely likes a second photo, social-networking system 160 may determinethat the user has a higher coefficient with respect to the first photothan the second photo because having a tagged-in-type relationship withcontent may be assigned a higher weight and/or rating than having alike-type relationship with content. In particular embodiments,social-networking system 160 may calculate a coefficient for a firstuser based on the relationship one or more second users have with aparticular object. In other words, the connections and coefficientsother users have with an object may affect the first user's coefficientfor the object. As an example and not by way of limitation, if a firstuser is connected to or has a high coefficient for one or more secondusers, and those second users are connected to or have a highcoefficient for a particular object, social-networking system 160 maydetermine that the first user should also have a relatively highcoefficient for the particular object. In particular embodiments, thecoefficient may be based on the degree of separation between particularobjects. The lower coefficient may represent the decreasing likelihoodthat the first user will share an interest in content objects of theuser that is indirectly connected to the first user in the social graph200. As an example and not by way of limitation, social-graph entitiesthat are closer in the social graph 200 (i.e., fewer degrees ofseparation) may have a higher coefficient than entities that are furtherapart in the social graph 200.

In particular embodiments, social-networking system 160 may calculate acoefficient based on location information. Objects that aregeographically closer to each other may be considered to be more relatedor of more interest to each other than more distant objects. Inparticular embodiments, the coefficient of a user towards a particularobject may be based on the proximity of the object's location to acurrent location associated with the user (or the location of a clientsystem 130 of the user). A first user may be more interested in otherusers or concepts that are closer to the first user. As an example andnot by way of limitation, if a user is one mile from an airport and twomiles from a gas station, social-networking system 160 may determinethat the user has a higher coefficient for the airport than the gasstation based on the proximity of the airport to the user.

In particular embodiments, social-networking system 160 may performparticular actions with respect to a user based on coefficientinformation. Coefficients may be used to predict whether a user willperform a particular action based on the user's interest in the action.A coefficient may be used when generating or presenting any type ofobjects to a user, such as advertisements, search results, news stories,media, messages, notifications, or other suitable objects. Thecoefficient may also be utilized to rank and order such objects, asappropriate. In this way, social-networking system 160 may provideinformation that is relevant to user's interests and currentcircumstances, increasing the likelihood that they will find suchinformation of interest. In particular embodiments, social-networkingsystem 160 may generate content based on coefficient information.Content objects may be provided or selected based on coefficientsspecific to a user. As an example and not by way of limitation, thecoefficient may be used to generate media for the user, where the usermay be presented with media for which the user has a high overallcoefficient with respect to the media object. As another example and notby way of limitation, the coefficient may be used to generateadvertisements for the user, where the user may be presented withadvertisements for which the user has a high overall coefficient withrespect to the advertised object. In particular embodiments,social-networking system 160 may generate search results based oncoefficient information. Search results for a particular user may bescored or ranked based on the coefficient associated with the searchresults with respect to the querying user. As an example and not by wayof limitation, search results corresponding to objects with highercoefficients may be ranked higher on a search-results page than resultscorresponding to objects having lower coefficients.

In particular embodiments, social-networking system 160 may calculate acoefficient in response to a request for a coefficient from a particularsystem or process. To predict the likely actions a user may take (or maybe the subject of) in a given situation, any process may request acalculated coefficient for a user. The request may also include a set ofweights to use for various factors used to calculate the coefficient.This request may come from a process running on the online socialnetwork, from a third-party system 170 (e.g., via an API or othercommunication channel), or from another suitable system. In response tothe request, social-networking system 160 may calculate the coefficient(or access the coefficient information if it has previously beencalculated and stored). In particular embodiments, social-networkingsystem 160 may measure an affinity with respect to a particular process.Different processes (both internal and external to the online socialnetwork) may request a coefficient for a particular object or set ofobjects. Social-networking system 160 may provide a measure of affinitythat is relevant to the particular process that requested the measure ofaffinity. In this way, each process receives a measure of affinity thatis tailored for the different context in which the process will use themeasure of affinity.

In connection with social-graph affinity and affinity coefficients,particular embodiments may utilize one or more systems, components,elements, functions, methods, operations, or steps disclosed in U.S.patent application Ser. No. 11/503,093, filed 11 Aug. 2006, U.S. patentapplication Ser. No. 12/977,027, filed 22 Dec. 2010, U.S. patentapplication Ser. No. 12/978,265, filed 23 Dec. 2010, and U.S. patentapplication Ser. No. 13/632,869, filed 1 Oct. 2012, each of which isincorporated by reference.

Systems and Methods

FIG. 10 illustrates an example computer system 1000. In particularembodiments, one or more computer systems 1000 perform one or more stepsof one or more methods described or illustrated herein. In particularembodiments, one or more computer systems 1000 provide functionalitydescribed or illustrated herein. In particular embodiments, softwarerunning on one or more computer systems 1000 performs one or more stepsof one or more methods described or illustrated herein or providesfunctionality described or illustrated herein. Particular embodimentsinclude one or more portions of one or more computer systems 1000.Herein, reference to a computer system may encompass a computing device,and vice versa, where appropriate. Moreover, reference to a computersystem may encompass one or more computer systems, where appropriate.

This disclosure contemplates any suitable number of computer systems1000. This disclosure contemplates computer system 1000 taking anysuitable physical form. As example and not by way of limitation,computer system 1000 may be an embedded computer system, asystem-on-chip (SOC), a single-board computer system (SBC) (such as, forexample, a computer-on-module (COM) or system-on-module (SOM)), adesktop computer system, a laptop or notebook computer system, aninteractive kiosk, a mainframe, a mesh of computer systems, a mobiletelephone, a personal digital assistant (PDA), a server, a tabletcomputer system, or a combination of two or more of these. Whereappropriate, computer system 1000 may include one or more computersystems 1000; be unitary or distributed; span multiple locations; spanmultiple machines; span multiple data centers; or reside in a cloud,which may include one or more cloud components in one or more networks.Where appropriate, one or more computer systems 1000 may perform withoutsubstantial spatial or temporal limitation one or more steps of one ormore methods described or illustrated herein. As an example and not byway of limitation, one or more computer systems 1000 may perform in realtime or in batch mode one or more steps of one or more methods describedor illustrated herein. One or more computer systems 1000 may perform atdifferent times or at different locations one or more steps of one ormore methods described or illustrated herein, where appropriate.

In particular embodiments, computer system 1000 includes a processor1002, memory 1004, storage 1006, an input/output (I/O) interface 1008, acommunication interface 1010, and a bus 1012. Although this disclosuredescribes and illustrates a particular computer system having aparticular number of particular components in a particular arrangement,this disclosure contemplates any suitable computer system having anysuitable number of any suitable components in any suitable arrangement.

In particular embodiments, processor 1002 includes hardware forexecuting instructions, such as those making up a computer program. Asan example and not by way of limitation, to execute instructions,processor 1002 may retrieve (or fetch) the instructions from an internalregister, an internal cache, memory 1004, or storage 1006; decode andexecute them; and then write one or more results to an internalregister, an internal cache, memory 1004, or storage 1006. In particularembodiments, processor 1002 may include one or more internal caches fordata, instructions, or addresses. This disclosure contemplates processor1002 including any suitable number of any suitable internal caches,where appropriate. As an example and not by way of limitation, processor1002 may include one or more instruction caches, one or more datacaches, and one or more translation lookaside buffers (TLBs).Instructions in the instruction caches may be copies of instructions inmemory 1004 or storage 1006, and the instruction caches may speed upretrieval of those instructions by processor 1002. Data in the datacaches may be copies of data in memory 1004 or storage 1006 forinstructions executing at processor 1002 to operate on; the results ofprevious instructions executed at processor 1002 for access bysubsequent instructions executing at processor 1002 or for writing tomemory 1004 or storage 1006; or other suitable data. The data caches mayspeed up read or write operations by processor 1002. The TLBs may speedup virtual-address translation for processor 1002. In particularembodiments, processor 1002 may include one or more internal registersfor data, instructions, or addresses. This disclosure contemplatesprocessor 1002 including any suitable number of any suitable internalregisters, where appropriate. Where appropriate, processor 1002 mayinclude one or more arithmetic logic units (ALUs); be a multi-coreprocessor; or include one or more processors 1002. Although thisdisclosure describes and illustrates a particular processor, thisdisclosure contemplates any suitable processor.

In particular embodiments, memory 1004 includes main memory for storinginstructions for processor 1002 to execute or data for processor 1002 tooperate on. As an example and not by way of limitation, computer system1000 may load instructions from storage 1006 or another source (such as,for example, another computer system 1000) to memory 1004. Processor1002 may then load the instructions from memory 1004 to an internalregister or internal cache. To execute the instructions, processor 1002may retrieve the instructions from the internal register or internalcache and decode them. During or after execution of the instructions,processor 1002 may write one or more results (which may be intermediateor final results) to the internal register or internal cache. Processor1002 may then write one or more of those results to memory 1004. Inparticular embodiments, processor 1002 executes only instructions in oneor more internal registers or internal caches or in memory 1004 (asopposed to storage 1006 or elsewhere) and operates only on data in oneor more internal registers or internal caches or in memory 1004 (asopposed to storage 1006 or elsewhere). One or more memory buses (whichmay each include an address bus and a data bus) may couple processor1002 to memory 1004. Bus 1012 may include one or more memory buses, asdescribed below. In particular embodiments, one or more memorymanagement units (MMUs) reside between processor 1002 and memory 1004and facilitate accesses to memory 1004 requested by processor 1002. Inparticular embodiments, memory 1004 includes random access memory (RAM).This RAM may be volatile memory, where appropriate. Where appropriate,this RAM may be dynamic RAM (DRAM) or static RAM (SRAM). Moreover, whereappropriate, this RAM may be single-ported or multi-ported RAM. Thisdisclosure contemplates any suitable RAM. Memory 1004 may include one ormore memories 1004, where appropriate. Although this disclosuredescribes and illustrates particular memory, this disclosurecontemplates any suitable memory.

In particular embodiments, storage 1006 includes mass storage for dataor instructions. As an example and not by way of limitation, storage1006 may include a hard disk drive (HDD), a floppy disk drive, flashmemory, an optical disc, a magneto-optical disc, magnetic tape, or aUniversal Serial Bus (USB) drive or a combination of two or more ofthese. Storage 1006 may include removable or non-removable (or fixed)media, where appropriate. Storage 1006 may be internal or external tocomputer system 1000, where appropriate. In particular embodiments,storage 1006 is non-volatile, solid-state memory. In particularembodiments, storage 1006 includes read-only memory (ROM). Whereappropriate, this ROM may be mask-programmed ROM, programmable ROM(PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM),electrically alterable ROM (EAROM), or flash memory or a combination oftwo or more of these. This disclosure contemplates mass storage 1006taking any suitable physical form. Storage 1006 may include one or morestorage control units facilitating communication between processor 1002and storage 1006, where appropriate. Where appropriate, storage 1006 mayinclude one or more storages 1006. Although this disclosure describesand illustrates particular storage, this disclosure contemplates anysuitable storage.

In particular embodiments, I/O interface 1008 includes hardware,software, or both, providing one or more interfaces for communicationbetween computer system 1000 and one or more I/O devices. Computersystem 1000 may include one or more of these I/O devices, whereappropriate. One or more of these I/O devices may enable communicationbetween a person and computer system 1000. As an example and not by wayof limitation, an I/O device may include a keyboard, keypad, microphone,monitor, mouse, printer, scanner, speaker, still camera, stylus, tablet,touch screen, trackball, video camera, another suitable I/O device or acombination of two or more of these. An I/O device may include one ormore sensors. This disclosure contemplates any suitable I/O devices andany suitable I/O interfaces 1008 for them. Where appropriate, I/Ointerface 1008 may include one or more device or software driversenabling processor 1002 to drive one or more of these I/O devices. I/Ointerface 1008 may include one or more I/O interfaces 1008, whereappropriate. Although this disclosure describes and illustrates aparticular I/O interface, this disclosure contemplates any suitable I/Ointerface.

In particular embodiments, communication interface 1010 includeshardware, software, or both providing one or more interfaces forcommunication (such as, for example, packet-based communication) betweencomputer system 1000 and one or more other computer systems 1000 or oneor more networks. As an example and not by way of limitation,communication interface 1010 may include a network interface controller(NIC) or network adapter for communicating with an Ethernet or otherwire-based network or a wireless NIC (WNIC) or wireless adapter forcommunicating with a wireless network, such as a WI-FI network. Thisdisclosure contemplates any suitable network and any suitablecommunication interface 1010 for it. As an example and not by way oflimitation, computer system 1000 may communicate with an ad hoc network,a personal area network (PAN), a local area network (LAN), a wide areanetwork (WAN), a metropolitan area network (MAN), or one or moreportions of the Internet or a combination of two or more of these. Oneor more portions of one or more of these networks may be wired orwireless. As an example, computer system 1000 may communicate with awireless PAN (WPAN) (such as, for example, a BLUETOOTH WPAN), a WI-FInetwork, a WI-MAX network, a cellular telephone network (such as, forexample, a Global System for Mobile Communications (GSM) network), orother suitable wireless network or a combination of two or more ofthese. Computer system 1000 may include any suitable communicationinterface 1010 for any of these networks, where appropriate.Communication interface 1010 may include one or more communicationinterfaces 1010, where appropriate. Although this disclosure describesand illustrates a particular communication interface, this disclosurecontemplates any suitable communication interface.

In particular embodiments, bus 1012 includes hardware, software, or bothcoupling components of computer system 1000 to each other. As an exampleand not by way of limitation, bus 1012 may include an AcceleratedGraphics Port (AGP) or other graphics bus, an Enhanced Industry StandardArchitecture (EISA) bus, a front-side bus (FSB), a HYPERTRANSPORT (HT)interconnect, an Industry Standard Architecture (ISA) bus, an INFINIBANDinterconnect, a low-pin-count (LPC) bus, a memory bus, a Micro ChannelArchitecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, aPCI-Express (PCIe) bus, a serial advanced technology attachment (SATA)bus, a Video Electronics Standards Association local (VLB) bus, oranother suitable bus or a combination of two or more of these. Bus 1012may include one or more buses 1012, where appropriate. Although thisdisclosure describes and illustrates a particular bus, this disclosurecontemplates any suitable bus or interconnect.

Herein, a computer-readable non-transitory storage medium or media mayinclude one or more semiconductor-based or other integrated circuits(ICs) (such, as for example, field-programmable gate arrays (FPGAs) orapplication-specific ICs (ASICs)), hard disk drives (HDDs), hybrid harddrives (HHDs), optical discs, optical disc drives (ODDs),magneto-optical discs, magneto-optical drives, floppy diskettes, floppydisk drives (FDDs), magnetic tapes, solid-state drives (SSDs),RAM-drives, SECURE DIGITAL cards or drives, any other suitablecomputer-readable non-transitory storage media, or any suitablecombination of two or more of these, where appropriate. Acomputer-readable non-transitory storage medium may be volatile,non-volatile, or a combination of volatile and non-volatile, whereappropriate.

Miscellaneous

Herein, “or” is inclusive and not exclusive, unless expressly indicatedotherwise or indicated otherwise by context. Therefore, herein, “A or B”means “A, B, or both,” unless expressly indicated otherwise or indicatedotherwise by context. Moreover, “and” is both joint and several, unlessexpressly indicated otherwise or indicated otherwise by context.Therefore, herein, “A and B” means “A and B, jointly or severally,”unless expressly indicated otherwise or indicated otherwise by context.

The scope of this disclosure encompasses all changes, substitutions,variations, alterations, and modifications to the example embodimentsdescribed or illustrated herein that a person having ordinary skill inthe art would comprehend. The scope of this disclosure is not limited tothe example embodiments described or illustrated herein. Moreover,although this disclosure describes and illustrates respectiveembodiments herein as including particular components, elements,feature, functions, operations, or steps, any of these embodiments mayinclude any combination or permutation of any of the components,elements, features, functions, operations, or steps described orillustrated anywhere herein that a person having ordinary skill in theart would comprehend. Furthermore, reference in the appended claims toan apparatus or system or a component of an apparatus or system beingadapted to, arranged to, capable of, configured to, enabled to, operableto, or operative to perform a particular function encompasses thatapparatus, system, component, whether or not it or that particularfunction is activated, turned on, or unlocked, as long as thatapparatus, system, or component is so adapted, arranged, capable,configured, enabled, operable, or operative.

What is claimed is:
 1. A method comprising: receiving, from a clientsystem of a first user, a text query comprising one or more n-grams,wherein at least one of the n-grams is an ambiguous n-gram; searching aplurality of keyword generators to identify one or more keywordsuggestions matching the ambiguous n-gram, each keyword generator beinga source of a particular type of a plurality of types, each keywordsuggestion being of a type corresponding to the type of the keywordgenerator that identified the keyword suggestion; calculating, for eachkeyword generator, by a particular scoring algorithm for the respectivekeyword generator, a keyword score for each identified keywordsuggestion identified by the respective keyword generator, wherein thescoring algorithm comprises a plurality of weighting factors, theparticular weighting factors used for the particular scoring algorithmfor each respective keyword generator being based on at least the typeof the keyword suggestion generated by the keyword generator; generatinga set of suggested queries, each suggested query comprising at least aportion of the text query and one or more identified keyword suggestionshaving a keyword score greater than a threshold keyword score; filteringone or more suggested queries from the set of suggested queries based onprivacy settings associated with the identified keyword suggestions; andsending, to the client system responsive to receiving the text query,instructions for presenting one or more of the suggested queries fromthe post-filtered set.
 2. The method of claim 1, wherein each identifiedkeyword suggestion corresponds to one or more concepts or entitiesassociated with an online social network.
 3. The method of claim 1,wherein the suggested queries are presented at the client system inranked order based at least on the keyword scores of the identifiedkeyword suggestions comprising each suggested query.
 4. The method ofclaim 1, wherein at least one keyword generator comprises a query-logkeyword generator.
 5. The method of claim 4, wherein the query-logkeyword generator identifies one or more query-log keyword suggestionsbased on search queries previously received from a plurality of clientsystems.
 6. The method of claim 5, wherein the keyword score for eachidentified query-log keyword suggestion is calculated based at least inpart on one or more of: a number of times each query-log keywordsuggestion has been searched; or a number of times each query-logkeyword suggestion was selected.
 7. The method of claim 1, wherein atleast one keyword generator comprises a typeahead keyword generator. 8.The method of claim 7, wherein the typeahead keyword generatoridentifies one or more typeahead keyword suggestions by identifyingconcepts or entities matching the ambiguous n-gram, wherein a typeaheadkeyword suggestion is identified corresponding to each identifiedconcept or entity matching the ambiguous n-gram.
 9. The method of claim8, wherein the keyword score for each identified typeahead keywordsuggestion is calculated based at least in part on one or more of: apopularity of the concept or entity with which each typeahead keywordsuggestion corresponds; a number of times the typeahead keywordsuggestion has been searched; or a number of times a profile page on anonline social network associated with the concept or entity with whicheach typeahead keyword suggestion corresponds has been visited.
 10. Themethod of claim 1, wherein at least one keyword generator comprises ametadata keyword generator.
 11. The method of claim 10, wherein themetadata keyword generator identifies one or more keywords by:identifying social-graph information associated with the first usercorresponding to one or more n-grams identified from the text query; andidentifying one or more metadata keyword suggestions based on theidentified social-graph information.
 12. The method of claim 1, furthercomprising: accessing a social graph comprising a plurality of nodes anda plurality of edges connecting the nodes, the nodes comprising: a firstnode corresponding to the first user; and a plurality of second nodesthat each correspond to a concept or an entity associated with an onlinesocial network; and wherein each identified keyword suggestioncorresponds to one or more second nodes of the plurality of secondnodes.
 13. The method of claim 12, wherein filtering one or moresuggested queries from the set of suggested queries comprises filteringone or more suggested queries from the set of suggested queries based onprivacy settings associated with the second nodes corresponding to theidentified keyword suggestions of the suggested queries, wherein aprivacy setting for each second node is based on at least a degree ofseparation between the first node and the second node.
 14. The method ofclaim 12, wherein at least one keyword generator comprises agrammar-parser keyword generator.
 15. The method of claim 14, whereinthe grammar-parser keyword generator identifies one or moregrammar-parser keyword suggestions by: identifying one or more edges orone or more second nodes, each of the identified edges or identifiednodes corresponding to one or more n-grams identified from the textquery; accessing a context-free grammar model comprising a plurality ofgrammars, each grammar comprising one or more query tokens; identifyingone or more grammars, each identified grammar having one or more querytokens corresponding to at least one of the identified second nodes oridentified edges; and generating one or more grammar-parser keywordsuggestions, each grammar-parser keyword suggestion corresponding to aquery token of an identified grammar.
 16. The method of claim 15,wherein the keyword score for each grammar-parser keyword suggestion iscalculated based at least in part on one or more of: a degree ofseparation between the first node and the identified second nodescorresponding to the query tokens of the identified grammar, whereineach edge between two nodes represents a single degree of separationbetween them; edges corresponding to the query tokens of the grammar; anumber of identified edges connected to the identified second nodescorresponding to the query tokens of the grammar; or a search historyassociated with the first user.
 17. The method of claim 1, furthercomprising: blending the keyword suggestions from the plurality ofkeyword generators to form a set of blended keyword suggestions.
 18. Themethod of claim 1, further comprising: determining, for each identifiedkeyword suggestion, whether the identified keyword suggestion results ina null-search; and removing each keyword suggestion resulting in anull-search from the identified keyword suggestions.
 19. One or morecomputer-readable non-transitory storage media embodying software thatis operable when executed to: receive, from a client system of a firstuser, a text query comprising one or more n-grams, wherein at least oneof the n-grams is an ambiguous n-gram; search a plurality of keywordgenerators to identify one or more keyword suggestions matching theambiguous n-gram, each keyword generator being a source of a particulartype of a plurality of types, each keyword suggestion being of a typecorresponding to the type of the keyword generator that identified thekeyword suggestion; calculate, for each keyword generator, by aparticular scoring algorithm for the respective keyword generator, akeyword score for each identified keyword suggestion identified by therespective keyword generator, wherein the scoring algorithm comprises aplurality of weighting factors, the particular weighting factors usedfor the particular scoring algorithm for each respective keywordgenerator being based on at least the type of the keyword suggestiongenerated by the keyword generator; generate a set of suggested queries,each suggested query comprising at least a portion of the text query andone or more identified keyword suggestions having a keyword scoregreater than a threshold keyword score; filter one or more suggestedqueries from the set of suggested queries based on privacy settingsassociated with the identified keyword suggestions; and send, to theclient system responsive to receiving the text query, instructions forpresenting one or more of the suggested queries from the post-filteredset.
 20. A system comprising: one or more processors; and a memorycoupled to the processors comprising instructions executable by theprocessors, the processors operable when executing the instructions to:receive, from a client system of a first user, a text query comprisingone or more n-grams, wherein at least one of the n-grams is an ambiguousn-gram; search a plurality of keyword generators to identify one or morekeyword suggestions matching the ambiguous n-gram, each keywordgenerator being a source of a particular type of a plurality of types,each keyword suggestion being of a type corresponding to the type of thekeyword generator that identified the keyword suggestion; calculate, foreach keyword generator, by a particular scoring algorithm for therespective keyword generator, a keyword score for each identifiedkeyword suggestion identified by the respective keyword generator,wherein the scoring algorithm comprises a plurality of weightingfactors, the particular weighting factors used for the particularscoring algorithm for each respective keyword generator being based onat least the type of the keyword suggestion generated by the keywordgenerator; generate a set of suggested queries, each suggested querycomprising at least a portion of the text query and one or moreidentified keyword suggestions having a keyword score greater than athreshold keyword score; filter one or more suggested queries from theset of suggested queries based on privacy settings associated with theidentified keyword suggestions; and send, to the client systemresponsive to receiving the text query, instructions for presenting oneor more of the suggested queries from the post-filtered set.